By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,203 Members | 1,358 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,203 IT Pros & Developers. It's quick & easy.

To validate that the Combo box save's only 6 digits

P: 3
Hi, I wanted the combo box in my form to accept only 6 digits not more or less than 6. Could anyone help with the code that I need to write in VB
Apr 19 '07 #1
Share this Question
Share on Google+
2 Replies


hariharanmca
100+
P: 1,977
Hi, I wanted the combo box in my form to accept only 6 digits not more or less than 6. Could anyone help with the code that I need to write in VB
Expand|Select|Wrap|Line Numbers
  1. if len(trim(cmbName.Text))<>6 then
  2.          msgbox "Enter 6 digit",vbInformation
  3. end if
Apr 19 '07 #2

Expert 5K+
P: 8,434
Expand|Select|Wrap|Line Numbers
  1. if len(trim(cmbName.Text))<>6 then
  2.          msgbox "Enter 6 digit",vbInformation
  3. end if
Thanks for that.

Just a note - you'll want to be careful where you do this kind of check. For example, if you do it in the LostFocus event, your user may find they can't quit the program because it won't let them go to the "Cancel/Exit" button
Apr 26 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.