ComboBox Help !

let's say i have a Combobox which contain a list (January , February ... December) .So what i want to do is , when u insert a value between 1 to 12 into a textbox , it'll automatically correspond to the comboBox listindex and selected the actual Month .


for exmaple , text1 = 3 , then the combobox will automatically shift to March .

thanks

vb_newbieAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

vb_newbieAuthor Commented:
issit impossible to do that ?
0
vb_newbieAuthor Commented:
issit impossible to do that ?
0
GPrentice00Commented:
Option Explicit
' Form with combo1 and Text1 controls.
' Combo1 populated with Jan,Feb, etc... (12 entries)
' Index of Jan=0, Index of Feb=1...

Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
   ' detect the enter key press
   If KeyCode = vbKeyReturn Then
      PopCombo
   End If
End Sub

Private Sub Text1_Validate(Cancel As Boolean)
   ' Validation fires when focus is being shifted to a different control
   PopCombo
End Sub
   
Private Sub PopCombo()
' Call this procedure at any time you want the text value examined
' and transferred into a combo box display...

   Dim vText As Single
   If Not IsNumeric(Text1) Then
      MsgBox "Not an integer 1-12"
      Text1 = ""
   Else 'is a numeric entry
      vText = Val(Text1)
      If vText > 0 And vText < 13 Then
         Combo1 = Combo1.List(vText - 1)
      Else
         MsgBox "Must be positive integer within range 1-12"
         Text1 = ""
      End If
   End If


End Sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
vb_newbieAuthor Commented:
issit impossible to do that ?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.