473,768 Members | 3,985 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Capturing input from a textbox

Hello,

I am trying to make a program that when someone uses a scanner to scan
a barcode that the number will automaticly be entered into a .txt
file. I tired to use the most of the events and none have seemed to
work .Does anyone have any ideas. I and using VB.net 2005. Thank you

Aug 24 '07 #1
11 2263
My barcode scanners (Intermec) add a CRLF to the end of the text
automatically, and yours probably does to. If you look for that
character on the KeyDown event, you should be able to pick up the text
and use the System.IO namespace classes to write the file.
Steve C.
MCAD,MCSE,MCP+I ,CNE,CNA,CCNA
dt*******@dunha mshq.com wrote:
Hello,

I am trying to make a program that when someone uses a scanner to scan
a barcode that the number will automaticly be entered into a .txt
file. I tired to use the most of the events and none have seemed to
work .Does anyone have any ideas. I and using VB.net 2005. Thank you
Aug 24 '07 #2
On Aug 24, 10:43 am, Steve <lnuxguy_NOMAIL _PLEA...@gmail. comwrote:
My barcode scanners (Intermec) add a CRLF to the end of the text
automatically, and yours probably does to. If you look for that
character on the KeyDown event, you should be able to pick up the text
and use the System.IO namespace classes to write the file.

Steve C.
MCAD,MCSE,MCP+I ,CNE,CNA,CCNA

dterib...@dunha mshq.com wrote:
Hello,
I am trying to make a program that when someone uses a scanner to scan
a barcode that the number will automaticly be entered into a .txt
file. I tired to use the most of the events and none have seemed to
work .Does anyone have any ideas. I and using VB.net 2005. Thank you- Hide quoted text -

- Show quoted text -
Steve,

Thank you for that idea. I will have to try that out and see what
happens.

Aug 24 '07 #3
dt*******@dunha mshq.com wrote:
On Aug 24, 10:43 am, Steve <lnuxguy_NOMAIL _PLEA...@gmail. comwrote:
>My barcode scanners (Intermec) add a CRLF to the end of the text
automaticall y, and yours probably does to. If you look for that
character on the KeyDown event, you should be able to pick up the text
and use the System.IO namespace classes to write the file.

Steve C.
MCAD,MCSE,MCP+ I,CNE,CNA,CCNA

dterib...@dunh amshq.com wrote:
>>Hello,
I am trying to make a program that when someone uses a scanner to scan
a barcode that the number will automaticly be entered into a .txt
file. I tired to use the most of the events and none have seemed to
work .Does anyone have any ideas. I and using VB.net 2005. Thank you- Hide quoted text -
- Show quoted text -

Steve,

Thank you for that idea. I will have to try that out and see what
happens.
Also,
Take a look at the com port "serialport " object as well.
Some new scanners are USB and they have a driver that actually assigns a
com port to the USB port of a scanner.
So what I do is I have teh SerialPort listening to a comport and flush
that to the "topmost" application or to whatever textbox I need to.

Miro
Aug 24 '07 #4
On Aug 24, 11:29 am, Miro <miron...@golde n.netwrote:
dterib...@dunha mshq.com wrote:
On Aug 24, 10:43 am, Steve <lnuxguy_NOMAIL _PLEA...@gmail. comwrote:
My barcode scanners (Intermec) add a CRLF to the end of the text
automatically, and yours probably does to. If you look for that
character on the KeyDown event, you should be able to pick up the text
and use the System.IO namespace classes to write the file.
Steve C.
MCAD,MCSE,MCP+I ,CNE,CNA,CCNA
dterib...@dunha mshq.com wrote:
Hello,
I am trying to make a program that when someone uses a scanner to scan
a barcode that the number will automaticly be entered into a .txt
file. I tired to use the most of the events and none have seemed to
work .Does anyone have any ideas. I and using VB.net 2005. Thank you- Hide quoted text -
- Show quoted text -
Steve,
Thank you for that idea. I will have to try that out and see what
happens.

Also,
Take a look at the com port "serialport " object as well.
Some new scanners are USB and they have a driver that actually assigns a
com port to the USB port of a scanner.
So what I do is I have teh SerialPort listening to a comport and flush
that to the "topmost" application or to whatever textbox I need to.

Miro- Hide quoted text -

- Show quoted text -
Miro,

I will also look into this one. I will have to see what will work be
for this application. Thank you again.

Aug 24 '07 #5
On Aug 24, 10:43 am, Steve <lnuxguy_NOMAIL _PLEA...@gmail. comwrote:
My barcode scanners (Intermec) add a CRLF to the end of the text
automatically, and yours probably does to. If you look for that
character on the KeyDown event, you should be able to pick up the text
and use the System.IO namespace classes to write the file.

Steve C.
MCAD,MCSE,MCP+I ,CNE,CNA,CCNA

dterib...@dunha mshq.com wrote:
Hello,
I am trying to make a program that when someone uses a scanner to scan
a barcode that the number will automaticly be entered into a .txt
file. I tired to use the most of the events and none have seemed to
work .Does anyone have any ideas. I and using VB.net 2005. Thank you- Hide quoted text -

- Show quoted text -
Steve,

I did code this as follows. However I am having the problem of it only
getting the last digit of the serial number. Can you give me a little
more help.
Dim oFile As System.IO.File
Dim oWrite As System.IO.Strea mWriter

oWrite = oFile.CreateTex t("C:\sample2.t xt")
oWrite.WriteLin e(TextBox1.Text )
oWrite.Close()
TextBox1.Text = ""
End Sub
Aug 27 '07 #6
You're missing the .Flush() call before you close the StreamWriter. It
should be something like this:

oWrite.WriteLin e(TextBox1.Text )
oWrite.Flush()
oWrite.Close()

See if that helps.
Steve C.
MCSD,MCAD,MCSE, MCP+I,CNE,CNA,C CNA
dt*******@dunha mshq.com wrote:
On Aug 24, 10:43 am, Steve <lnuxguy_NOMAIL _PLEA...@gmail. comwrote:
>My barcode scanners (Intermec) add a CRLF to the end of the text
automaticall y, and yours probably does to. If you look for that
character on the KeyDown event, you should be able to pick up the text
and use the System.IO namespace classes to write the file.

Steve C.
MCAD,MCSE,MCP+ I,CNE,CNA,CCNA

dterib...@dunh amshq.com wrote:
>>Hello,
I am trying to make a program that when someone uses a scanner to scan
a barcode that the number will automaticly be entered into a .txt
file. I tired to use the most of the events and none have seemed to
work .Does anyone have any ideas. I and using VB.net 2005. Thank you- Hide quoted text -
- Show quoted text -

Steve,

I did code this as follows. However I am having the problem of it only
getting the last digit of the serial number. Can you give me a little
more help.
Dim oFile As System.IO.File
Dim oWrite As System.IO.Strea mWriter

oWrite = oFile.CreateTex t("C:\sample2.t xt")
oWrite.WriteLin e(TextBox1.Text )
oWrite.Close()
TextBox1.Text = ""
End Sub

Aug 27 '07 #7
On Aug 27, 10:01 am, Steve <lnuxguy_NOMAIL _PLEA...@gmail. comwrote:
You're missing the .Flush() call before you close the StreamWriter. It
should be something like this:

oWrite.WriteLin e(TextBox1.Text )
oWrite.Flush()
oWrite.Close()

See if that helps.

Steve C.
MCSD,MCAD,MCSE, MCP+I,CNE,CNA,C CNA

dterib...@dunha mshq.com wrote:
On Aug 24, 10:43 am, Steve <lnuxguy_NOMAIL _PLEA...@gmail. comwrote:
My barcode scanners (Intermec) add a CRLF to the end of the text
automatically, and yours probably does to. If you look for that
character on the KeyDown event, you should be able to pick up the text
and use the System.IO namespace classes to write the file.
Steve C.
MCAD,MCSE,MCP+I ,CNE,CNA,CCNA
dterib...@dunha mshq.com wrote:
Hello,
I am trying to make a program that when someone uses a scanner to scan
a barcode that the number will automaticly be entered into a .txt
file. I tired to use the most of the events and none have seemed to
work .Does anyone have any ideas. I and using VB.net 2005. Thank you- Hide quoted text -
- Show quoted text -
Steve,
I did code this as follows. However I am having the problem of it only
getting the last digit of the serial number. Can you give me a little
more help.
Dim oFile As System.IO.File
Dim oWrite As System.IO.Strea mWriter
oWrite = oFile.CreateTex t("C:\sample2.t xt")
oWrite.WriteLin e(TextBox1.Text )
oWrite.Close()
TextBox1.Text = ""
End Sub- Hide quoted text -

- Show quoted text -
It did not help. It has something to do with how I am clearing the
text box at the end. If I comment out textbox1.text out this part of
the code I can get the whole sku to show up in my file. If i had to
delete the old sku from the textbox everytime this would defeat the
purpose.
Aug 27 '07 #8
So if you don't clear the textbox, it works fine. Then you say that you
don't want to clear the textbox. So what's the problem? (I think I'm
missing something...)

Also, you can simplify the code more by passing the filename string
directly to the constructor of StreamWriter. Then you don't need oFile
at all.
Steve C.
MCSD,MCAD,MCSE, MCP+I,CNE,CNA,C CNA
dt*******@dunha mshq.com wrote:
On Aug 27, 10:01 am, Steve <lnuxguy_NOMAIL _PLEA...@gmail. comwrote:
>You're missing the .Flush() call before you close the StreamWriter. It
should be something like this:

oWrite.WriteLi ne(TextBox1.Tex t)
oWrite.Flush ()
oWrite.Close ()

See if that helps.

Steve C.
MCSD,MCAD,MCSE ,MCP+I,CNE,CNA, CCNA

dterib...@dunh amshq.com wrote:
>>On Aug 24, 10:43 am, Steve <lnuxguy_NOMAIL _PLEA...@gmail. comwrote:
My barcode scanners (Intermec) add a CRLF to the end of the text
automaticall y, and yours probably does to. If you look for that
character on the KeyDown event, you should be able to pick up the text
and use the System.IO namespace classes to write the file.
Steve C.
MCAD,MCSE,MC P+I,CNE,CNA,CCN A
dterib...@du nhamshq.com wrote:
Hello,
I am trying to make a program that when someone uses a scanner to scan
a barcode that the number will automaticly be entered into a .txt
file. I tired to use the most of the events and none have seemed to
work .Does anyone have any ideas. I and using VB.net 2005. Thank you- Hide quoted text -
- Show quoted text -
Steve,
I did code this as follows. However I am having the problem of it only
getting the last digit of the serial number. Can you give me a little
more help.
Dim oFile As System.IO.File
Dim oWrite As System.IO.Strea mWriter
oWrite = oFile.CreateTex t("C:\sample2.t xt")
oWrite.WriteLin e(TextBox1.Text )
oWrite.Close()
TextBox1.Text = ""
End Sub- Hide quoted text -
- Show quoted text -

It did not help. It has something to do with how I am clearing the
text box at the end. If I comment out textbox1.text out this part of
the code I can get the whole sku to show up in my file. If i had to
delete the old sku from the textbox everytime this would defeat the
purpose.

Aug 27 '07 #9
Steve,

No I do want to clear the text box. I want them to be able to scan all
the items without having to touch a mouse or keyboard. I found
different code and it will let me clear it but it lines up funny. I
have posted the Code and the output below.
Dim fw As StreamWriter

Dim ReadString As String

Try
'Pass the file path and name to the StreamWriter
constructor.
'Indicate that Append is True, so file will not be
overwritten.
fw = New StreamWriter("C :\sample2.txt", True)
ReadString = TextBox2.Text
fw.WriteLine(Re adString)
Finally
'Close the file.
fw.Close()

End Try
TextBox2.Text = ""

I get this for output in the sample.txt file.
1
2
3
4
5
6

I want it to be:
123456

Thank you again for all your help.

On Aug 27, 11:35 am, Steve <lnuxguy_NOMAIL _PLEA...@gmail. comwrote:
So if you don't clear the textbox, it works fine. Then you say that you
don't want to clear the textbox. So what's the problem? (I think I'm
missing something...)

Also, you can simplify the code more by passing the filename string
directly to the constructor of StreamWriter. Then you don't need oFile
at all.

Steve C.
MCSD,MCAD,MCSE, MCP+I,CNE,CNA,C CNA

dterib...@dunha mshq.com wrote:
On Aug 27, 10:01 am, Steve <lnuxguy_NOMAIL _PLEA...@gmail. comwrote:
You're missing the .Flush() call before you close the StreamWriter. It
should be something like this:
oWrite.WriteLin e(TextBox1.Text )
oWrite.Flush()
oWrite.Close()
See if that helps.
Steve C.
MCSD,MCAD,MCSE, MCP+I,CNE,CNA,C CNA
dterib...@dunha mshq.com wrote:
On Aug 24, 10:43 am, Steve <lnuxguy_NOMAIL _PLEA...@gmail. comwrote:
My barcode scanners (Intermec) add a CRLF to the end of the text
automatically , and yours probably does to. If you look for that
character on the KeyDown event, you should be able to pick up the text
and use the System.IO namespace classes to write the file.
Steve C.
MCAD,MCSE,MCP +I,CNE,CNA,CCNA
dterib...@dun hamshq.com wrote:
Hello,
I am trying to make a program that when someone uses a scanner to scan
a barcode that the number will automaticly be entered into a .txt
file. I tired to use the most of the events and none have seemed to
work .Does anyone have any ideas. I and using VB.net 2005. Thank you- Hide quoted text -
- Show quoted text -
Steve,
I did code this as follows. However I am having the problem of it only
getting the last digit of the serial number. Can you give me a little
more help.
Dim oFile As System.IO.File
Dim oWrite As System.IO.Strea mWriter
oWrite = oFile.CreateTex t("C:\sample2.t xt")
oWrite.WriteLin e(TextBox1.Text )
oWrite.Close()
TextBox1.Text = ""
End Sub- Hide quoted text -
- Show quoted text -
It did not help. It has something to do with how I am clearing the
text box at the end. If I comment out textbox1.text out this part of
the code I can get the whole sku to show up in my file. If i had to
delete the old sku from the textbox everytime this would defeat the
purpose.- Hide quoted text -

- Show quoted text -

Aug 27 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
15867
by: Sharad Gupta | last post by:
i have this problem of capturing the filename on the instance when onclick is activated in the <body> the function should catch the filename and display it. Second problem, i have to catch the image name in the same fashion using =onclick showimage(this). Is this possible at at I have tried all combinations of document.getElementbyId(); document.getElementbyName(); document.getElementbyTagName();
7
20371
by: jerrygarciuh | last post by:
Hello, I have been playing with various Googled solutions for capturing the <Enter> key to suppress form submission. My first question is whether anyone has a script that works in all common browsers? The script bellow is IE only. It fails FF 1.0 and NN 7. Also, if I can trap the keypress I would like to use it to tab to the next tabindex.
33
5642
by: Joerg Schuster | last post by:
Hello, Python regular expressions must not have more than 100 capturing groups. The source code responsible for this reads as follows: # XXX: <fl> get rid of this limitation! if p.pattern.groups > 100: raise AssertionError( "sorry, but this version only supports 100 named groups"
2
14685
by: George Durzi | last post by:
I have a text box and a button, and I want the enter key to run the click event of the button. The textbox and button are inside a user control. I tried all sorts of stuff with the __EVENTTARGET hidden field with no luck. Here's what I'm doing function KeyDownHandler(btn) { if (event.keyCode == 13) {
10
6020
by: Andrew | last post by:
Hi, I have a messagebox that pops up due to an event. I did it in javascript. ie. alert("Time's up. Assessment Ended"); I want to capture the OK and Cancel events of this alert messagebox. My code is in C#/ASP.NET. TIA. Andrew.
4
7122
by: Bruce HS | last post by:
I do an autopostback from a text box in a datagrid template. How can I capture the event in the code behind? Handles DataGrid1.textboxname.TextChanged doesn't work, and I don't see any DataGrid events appropriate for a textchanged event. Please respond, and save me a $245 support call to MS!
3
1747
by: Muriel | last post by:
I'm developing a website using visual studio .NET I have a login form with a couple of textboxes and a login button. What I want to do is capture the Enter key so that when the user presses Enter, it will click the submit button. I have searched the Internet for hours now trying to find out how to do it, but any methods that I have seen do not work. Can anyone help me do that?
2
2280
by: jbigham | last post by:
Hello, I'd like to capture key events using javascript, but don't want to process such events when the user is typing into an input box or into a textarea. As an example, gmail has a feature where you can type "r" anywhere on the page while viewing a message and it will open a reply box, but if you type an "r" while entering text into a form, it doesn't do this. My question is how to do this most efficiently.
9
24420
RBPierce
by: RBPierce | last post by:
Hey all, hoping someone can help me with a workaround. I've got an event set to fire when a textbox changes or loses focus- no problems. However, when the user clicks into the box and Right Click--> Pastes a value into it, I can't get any event to fire. I've tried onClick, OnChange, OnMouseDown, onMouseUp, onKeyDown, and onKeyUp. <input type='text' onChange="alert('Changed')" onClick="alert('Clicked')" onMouseDown="alert('onMouseDown')"...
0
9407
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9961
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9843
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8840
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7384
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5283
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5425
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3534
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2808
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.