Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old October 30th, 2003, 01:33 PM
jodpro32 jodpro32 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 4 jodpro32 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Talking Validating Text Box Scanned Entry

I am trying to do a validation on a scanned entry into a VB Text Box. I can break the string into the parts I need to validate. Here is an example:

I have a scanned entry of 'SE1234567'
First I need to validate it is 9 characters long, DONE.
2nd, need to validate the first to characters are 'SE', DONE.
3rd, need to validate the last 7 characters are numbers and not letters, help....

Looking ahead I have a similar problem where a certain position on a string has to be a letter....

I have looked every where and tried many things, but can't get this one...

Help would be GREATLY appriciated!!!!

Reply With Quote
  #2  
Old October 30th, 2003, 01:48 PM
Fisherman's Avatar
Fisherman Fisherman is offline
Inherits Programmer.Slacker
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2003
Location: Between my Id and your Ego
Posts: 2,171 Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 9 h 1 m 37 sec
Reputation Power: 110
Send a message via ICQ to Fisherman Send a message via AIM to Fisherman
I did this - I put a textbox on a blank form in vb6, left everything default names. The put your sample string ("SE1234567") in the textbox text property in the properties window, and put the following the load procedure

Code:
Private Sub Form_Load()
Dim blnTrue As Boolean
Dim strString As String
blnTrue = IsNumeric(Mid(Text1.Text, 3, 7))
strString = CStr(Mid(Text1.Text, 3, 7))
MsgBox blnTrue & " " & strString
End Sub
__________________
Fisherman

"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." - A.Einstein

Reply With Quote
  #3  
Old October 30th, 2003, 02:04 PM
jodpro32 jodpro32 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 4 jodpro32 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Great, now...

Fisherman,

thanks for the help. That did the trick for the numerical IsNumeric values, what about letters? IsAlpha something?

Thanks again.

Joe

Reply With Quote
  #4  
Old October 30th, 2003, 02:36 PM
Fisherman's Avatar
Fisherman Fisherman is offline
Inherits Programmer.Slacker
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2003
Location: Between my Id and your Ego
Posts: 2,171 Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 9 h 1 m 37 sec
Reputation Power: 110
Send a message via ICQ to Fisherman Send a message via AIM to Fisherman
well, could you just do the inverse of the previous logic? IsNumeric will return a Boolean Value - True if it is, False if it isn't. If you call isNumeric(strValue) then you will get a return value of False

Reply With Quote
  #5  
Old October 30th, 2003, 02:42 PM
jodpro32 jodpro32 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 4 jodpro32 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Inverse

I thought about that, but it would be a problem if some how, they get some special characters in there. They would not be numeric, but also not letters either. For such a simple problem, I have spent a lot of time in this, strange.

Thanks in advance.

JOE

Reply With Quote
  #6  
Old October 30th, 2003, 03:32 PM
Fisherman's Avatar
Fisherman Fisherman is offline
Inherits Programmer.Slacker
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2003
Location: Between my Id and your Ego
Posts: 2,171 Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 9 h 1 m 37 sec
Reputation Power: 110
Send a message via ICQ to Fisherman Send a message via AIM to Fisherman
well, it's been a while since I studied data structures, but aren't the Ascii values of special characters evaluated as less than the Ascii values of normal text? if so, then you could use something like this to find out if it's a special character or not...

Code:
public Function isSpecialCharacter(byval str5 as string) as boolean
Dim str1 as string
dim str2 as string
dim str3 as string
dim str4 as string

str1 = "A"
str2 = "Z"
str3 = "a"
str4 = "z"

if str5 < str1 then
   return True
Elseif str5 > str2 and str5 < str3 then
   return True
elseif str5 > str4 then
   return true
else
   return false
end if

end Function


I just looked up an Ascii value table, there is one exception . The numeric values are less than "A", so you'll need to verify that isNumeric(value) = false before calling this function. the Ascii table is here . Hope it helps

Reply With Quote
  #7  
Old November 4th, 2003, 10:43 PM
lcs lcs is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 5 lcs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy Text box length limitation?

if the scanner keep on scanning while the data have not process by the system, how many scanned data(with enter key pass in) will the text box keep?

I'm facing a problem when the data capture from barcode scanner(keyboard wedge) and pass to the system , some time will cause the system automatically exit. Any one know why this happen?

Reply With Quote
  #8  
Old November 4th, 2003, 11:19 PM
Fisherman's Avatar
Fisherman Fisherman is offline
Inherits Programmer.Slacker
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2003
Location: Between my Id and your Ego
Posts: 2,171 Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 9 h 1 m 37 sec
Reputation Power: 110
Send a message via ICQ to Fisherman Send a message via AIM to Fisherman
I have to do that in programs where I work. We have the ability to not accept a new object into the system until we have processed the existing one. I would suggest that following your processing, you clear your test boxes. Then, at the beginning of your processing, you can check for the length of the value of the text boxes. If the length is greater than 0, then you know there is something in the boxes, and therefore, there is data processing. In that instance, you can either stop the new object from entering the system, and accept it later, or you can add you values to an array of enumerated values, thus "buffering" the data, allowing you to process it when the thread is available.

Reply With Quote
  #9  
Old November 5th, 2003, 12:00 AM
lcs lcs is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 5 lcs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
TQ Fisherman,

But i dun think i can block the object to be scan into system. Cause the system used in the production line which heavy data capture from scanner.The scan data need lots of verification until sometime the textbox will have few data in queue(mayb cause by verification or database blocking) . Is the system exit automatically related to the data scanned into textbox? If the textbox reach the max length, will it cause the exit problem? Any suggetion for handler such problem?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Validating Text Box Scanned Entry


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway