ok i'm using visual studio 2012 vb, i am trying to get a combo box to accept different lists based on a returned value from a variable with a different sub. i have transfered the value of the variable but i cant get the second list to populate in the combo
box. here is what i have thus far. Private Sub BirthMonth_SelectedIndexChanged(sender As Object, e As EventArgs) Handles BirthMonth.SelectedIndexChanged
'ASSINGING VALUE FOR BIRTH MONTH 1 - 12
Dim bmonth1 As String
Dim bmonth As Integer
bmonth1 = BirthMonth.SelectedItem.ToString
'GETTING BIRTH MONTH VALUE FROM USER INPUT ON DROP DOWN LIST'
If bmonth1 = "JAN" Then
bmonth = 1 And BirthDay.Focus()
ElseIf bmonth1 = "FEB" Then
bmonth = 2 And BirthDay.Focus()
ElseIf bmonth1 = "MAR" Then
bmonth = 3 And BirthDay.Focus()
ElseIf bmonth1 = "APR" Then
bmonth = 4 And BirthDay.Focus()
ElseIf bmonth1 = "MAY" Then
bmonth = 5 And BirthDay.Focus()
ElseIf bmonth1 = "JUN" Then
bmonth = 6 And BirthDay.Focus()
ElseIf bmonth1 = "JUL" Then
bmonth = 7 And BirthDay.Focus()
ElseIf bmonth1 = "AUG" Then
bmonth = 8 And BirthDay.Focus()
ElseIf bmonth1 = "SEP" Then
bmonth = 9 And BirthDay.Focus()
ElseIf bmonth1 = "OCT" Then
bmonth = 10 And BirthDay.Focus()
ElseIf bmonth1 = "NOV" Then
bmonth = 11 And BirthDay.Focus()
ElseIf bmonth1 = "DEC" Then
bmonth = 12 And BirthDay.Focus()
End If
'SENDING VARIABLE TO ANOTHER PRIVATE SUB'
Call BmonthTotal(bmonth)
End Sub
Private Sub BmonthTotal(bmonth As Integer)
Dim days() As String = {"1", "2", "3"}
Dim hello() As String = {"5", "6", "7"}
If bmonth = 4 Or 6 Or 9 Or 11 Then
Birthday.Items.AddRange(days)
ElseIf bmonth = 1 Or 2 Or 3 Then
Birthday.Items.AddRange(hello)
End If
End Sub
↧
problem with adding items to combo box
↧