|
You were very close. A couple of tweaks to your existing code yields something that does what you want, I think:
Private Sub Form1_Load(...) Handles MyBase.Loade
Dim Length(6) As String
Dim J As Integer
Length(1) = "Millimeter"
Length(2) = "Centimeter"
Length(3) = "M"
Length(4) = "cm"
Length(5) = "dm"
Length(6) = "mm"
For J = 1 To 6
cboStart.Items.Add(Length(J))
Next J
cboStart.SelectedIndex = 0
End Sub
If you wanted to get fancy, you could use an ArrayList and data binding, saving yourself the for-loop:
Private Sub Form1_Load(...) Handles MyBase.Load
Dim Length As New ArrayList()
Length.Add("Millimeter")
Length.Add("Centimeter")
Length.Add("M")
Length.Add("cm")
Length.Add("dm")
Length.Add("mm")
cboStart.DataSource = Length
End Sub
If you didn't already have the array of values lying around, you could also add them to the combo box directly:
Private Sub Form1_Load(...) Handles MyBase.Load
cboStart.Items.Add("Millimeter")
cboStart.Items.Add("Centimeter")
cboStart.Items.Add("M")
cboStart.Items.Add("cm")
cboStart.Items.Add("dm")
cboStart.Items.Add("mm")
cboStart.SelectedIndex = 0
End Sub
|