943,861 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 7781
  • VB.NET RSS
May 20th, 2004
0

How do I limit text char in Combo box?

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
x38class is offline Offline
24 posts
since May 2004
Jul 26th, 2004
0

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

use keyascii code on keypress event
Reputation Points: 10
Solved Threads: 0
Newbie Poster
lkexpert is offline Offline
6 posts
since Jul 2004
Aug 8th, 2004
0

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

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
x38class is offline Offline
24 posts
since May 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Connectivity problem with Sybase Adaptive Server 7.0
Next Thread in VB.NET Forum Timeline: Displaying pictures on Windows Forms using subprocedures in VB.NET





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC