How do I limit text char in Combo box?

Please support our VB.NET advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: May 2004
Posts: 16
Reputation: x38class is an unknown quantity at this point 
Solved Threads: 0
x38class x38class is offline Offline
Newbie Poster

How do I limit text char in Combo box?

 
0
  #1
May 20th, 2004
I have a combo box I want to limit user input

I have the following code on 'keypress' event

dim keyascii as short = asc(e.keychar)
dim s as string

if keyascii = 45 then
exit sub
end if
' allow '-' key

s=checkalphanumeric(s,"AN")
' My function to check keyascii
's returns 0-9, a-z, A-Z if true

if s="" then
exit sub
end if

e.handled=true

end sub

I have same code used for text boxes except 'e' is 'eventargs' & it works

I can still type anything in my combo box, am I missing something?

any help much appreciated
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 6
Reputation: lkexpert is an unknown quantity at this point 
Solved Threads: 0
lkexpert lkexpert is offline Offline
Newbie Poster

Re: How do I limit text char in Combo box?

 
0
  #2
Jul 26th, 2004
use keyascii code on keypress event
Reply With Quote Quick reply to this message  
Join Date: May 2004
Posts: 16
Reputation: x38class is an unknown quantity at this point 
Solved Threads: 0
x38class x38class is offline Offline
Newbie Poster

Re: How do I limit text char in Combo box?

 
0
  #3
Aug 8th, 2004
Sorry it took so long to reply, & thank you for taking an interest in my problem

It took a while to determine all the options I wanted to exclude, but the use of keyascii was most useful

Thanks again
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 6910 | Replies: 2
Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC