computer science
i would like to learn from you
Private Sub Form_Load() Combo1.AddItem ("Bits") Combo1.AddItem ("Bytes") Combo1.AddItem ("Kilobytes") Combo1.AddItem ("Megabytes") Combo1.AddItem ("Gigabytes") Combo1.AddItem ("Terabytes") Combo2.AddItem ("Bits") Combo2.AddItem ("Bytes") Combo2.AddItem ("Kilobytes") Combo2.AddItem ("Megabytes") Combo2.AddItem ("Gigabytes") Combo2.AddItem ("Terabytes") End Sub
Dim num1 As Integer num1 = Val(Text1.Text) If Not IsNumeric(num1) Then MsgBox ("Make sure your conversion is numeric.") Exit Sub End If
Select Case Combo1.Text Case "Bits" With Combo2 If .Text = "Bits" Then Text2.Text = num1 If .Text = "Bytes" Then Text2.Text = num1 / 8 If .Text = "Kilobytes" Then Text2.Text = num1 / 8 / 1024 If .Text = "Megabytes" Then Text2.Text = num1 / 8 / 1024 / 1024 If .Text = "Gigabytes" Then Text2.Text = num1 / 8 / 1024 / 1024 / 1024 If .Text = "Terabytes" Then Text2.Text = num1 / 8 / 1024 / 1024 / 1024 / 1024 End With
Case "Bytes" With Combo2 If .Text = "Bits" Then Text2.Text = num1 * 8 If .Text = "Bytes" Then Text2.Text = num1 If .Text = "Kilobytes" Then Text2.Text = num1 / 1024 If .Text = "Megabytes" Then Text2.Text = num1 / 1024 / 1024 If .Text = "Gigabytes" Then Text2.Text = num1 / 1024 / 1024 / 1024 If .Text = "Terabytes" Then Text2.Text = num1 / 1024 / 1024 / 1024 / 1024 End With
Case "Kilobytes" With Combo2 If .Text = "Bits" Then Text2.Text = num1 * 1024 * 8 If .Text = "Bytes" Then Text2.Text = num1 * 1024 If .Text = "Kilobytes" Then Text2.Text = num1 If .Text = "Megabytes" Then Text2.Text = num1 / 1024 If .Text = "Gigabytes" Then Text2.Text = num1 / 1024 / 1024 If .Text = "Terabytes" Then Text2.Text = num1 / 1024 / 1024 / 1024 End With
Case "Megabytes" With Combo2 If .Text = "Bits" Then Text2.Text = num1 * 1024 * 1024 * 8 If .Text = "Bytes" Then Text2.Text = num1 * 1024 * 1024 If .Text = "Kilobytes" Then Text2.Text = num1 * 1024 If .Text = "Megabytes" Then Text2.Text = num1 If .Text = "Gigabytes" Then Text2.Text = num1 / 1024 If .Text = "Terabytes" Then Text2.Text = num1 / 1024 / 1024 End With
Case "Gigabytes" With Combo2 If .Text = "Bits" Then Text2.Text = num1 * 1024 * 1024 * 1024 * 8 If .Text = "Bytes" Then Text2.Text = num1 * 1024 * 1024 * 1024 If .Text = "Kilobytes" Then Text2.Text = num1 * 1024 * 1024 If .Text = "Megabytes" Then Text2.Text = num1 * 1024 If .Text = "Gigabytes" Then Text2.Text = num1 If .Text = "Terabytes" Then Text2.Text = num1 / 1024 End With
Case "Terabytes" With Combo2 If .Text = "Bits" Then Text2.Text = num1 * 1024 * 1024 * 1024 * 1024 * 8 If .Text = "Bytes" Then Text2.Text = num1 * 1024 * 1024 * 1024 * 1024 If .Text = "Kilobytes" Then Text2.Text = num1 * 1024 * 1024 * 1024 If .Text = "Megabytes" Then Text2.Text = num1 * 1024 * 1024 If .Text = "Gigabytes" Then Text2.Text = num1 * 1024 If .Text = "Terabytes" Then Text2.Text = num1 End With