Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Other Development Tools
 Getting Textbox to read valid barcode in VB.Net

Author  Topic 

OfMartin
Starting Member

11 Posts

Posted - 2005-04-15 : 12:58:09
I'm creating a Visual Basic form that reads barcode input by the user. I need my textbox to read only alpha-numeric characters that are 10 characters long. Here's what I have so far...This code actually checks to see if the input is "numeric" not "alpha-numeric" like the comments say. Guys, please if you could help me, I'll forever be thankful.

Dim x As Int16
Dim strNew As String = ""

'Review all charactes in the txtBarcode text box to ensure that they are alpha-numeric digits
'Loop through all characters and pass alpha-numeric digits to a new string
For x = 0 To Len(txtBarcode.Text) - 1
If InStr("0123456789", txtBarcode.Text.Substring(x, 1)) > 0 Then
' Char is alpha-numeric
strNew += txtBarcode.Text.Substring(x, 1)
Else ' Char is not alpha-numeric
Beep() ' Warn user
lblHelp.Text = "Character is not alpha-numeric"
End If

OfMartin890@yahoo.com

OfMartin
Starting Member

11 Posts

Posted - 2005-04-15 : 19:38:39
wow, guys. I'm sorry again with this question. The reason why I asked you this question might be because I've been lacking some sleep. All textboxes by default accept alpha-numeric characters so there is no code to write to solve my question, which you guys probably figured in a blink of an eye and didn't figure it was worth bothering to type it out. For everyone who wasted their time with reading my question, I'm really apologize for the inconvenience. This probably won't be the last time I post something idiotic on this message board. Please bear some patience with me, I'm just sleep-deprived.

OfMartin890@yahoo.com
Go to Top of Page

carolinenew
Starting Member

4 Posts

Posted - 2014-05-26 : 22:58:44
it's ok, and i have no experience in VB.NET, but in C#.NET. anyway you can read this .NET tutorial to read barcode, hope it helps you.
Go to Top of Page
   

- Advertisement -