Hello,
Summary:
How do I set up text boxes so that when I enter numeric text in one box (named X_Test_Input) , it will raise events that the other box (named X_Accel_Raw_Value) will collect/consume and display the data in that second box.
Overview:
This is my first attempt Windows programming. My goal is to collect six numbers from an embedded device over Ethernet (five to ten times a second) and display them on my computer so as to have them available for further processing. In dividing this into small steps, I first want to be able to get values from somewhere and display that data. Only after I get the basic windows display part of this working will I attempt to get the data from the embedded device.
In my first step, the source of the data will be other text boxes. When I graduate from that stage, I will try Ethernet communications. I am having a difficult time in extracting the information I need from the tutorials. If you see a better path for me, please let me know.

geting numeric data in and out of text boxes
IndianScorpion
well in regards to when entering numeric text in a textbox, what exactly do you want to raise for the other textbox Which event to do what
DotNet_Student
sure. Well there is a lostfocus event and a textchanged event but you would be going for the one after the user has finished changing text. LostFocus would be one as well as perhaps the Validated event and also the Leave event
http://msdn2.microsoft.com/en-us/library/system.windows.forms.control.validated(VS.80).aspx
List of events for the TextBox control/class
http://msdn2.microsoft.com/en-us/library/f54axdak(VS.80).aspx
you simply go to the properties of that textbox in designer view, click the events icon (lightning symbol) and double click the event you want implemented so it gets fired when that condition happens
naiad
:-) The Enter event is what you are seeing, it will fire when you have entered the control. To use the Enter keypress, implement the keydown event and check the e.KeyCode parameter which will map/give you the Keys enum. Example
private sub TextBox1_KeyDown(byval sender as object, byval e as KeyEventArgs) Handles TextBox1.KeyDown
if e.KeyCode = System.Windows.Forms.Keys.Enter then
'they pressed the enter key
end if
end sub
Nagu
Hello ahmedilyas,
From your last response I have made some progress, but there remains someing I am missing. I created two text boxes named: X_Accel_Raw_Value and X_Test_Input.
I selected the X_Test_Input box, moved to the events list, and double clicked on "Enter" The compiler generated a method framework that I edited as follows:
private void X_Test_Input_Enter(object sender, EventArgs e){
X_Accel_Raw_Value.Text = X_Test_Input.Text;
}
(BTW: How do a mark a code segment. Another forum web site uses [code] and [/code] but that does not work here.)I expected that when I typed text into the text block X_Test_Input and pressed enter, the function that the C## IDE created for me would be called. The one line of code I added should copy the text into the second text box X_Accel_Raw_Value. When I run the program, type in the text, and press Enter, I get the low pitched Bonk kind of sound that seems to say, I don't like that.
So I put a break point in at the entrance to this new function. When I click on X_Test_Input the program breaks. I did not press Enter, I just clicked on it to bring it into focus. I see that as a problem. What do I not understand here
If I continue on throught the break point, I can enter text into the box, but pressing enter produces nothing but the bonk sound. When I click off the box, click back on, and step through the breakpoint, it does copy the text into the target box. Interesting.
What do I need to change so that when I click on X_Test_Input, enter text, then press the Enter key, the function will run But not until I press Enter.
Shijas
DevboyX
Thanks to ahmedilyas and Brendon for replying.
RE to ahmedilyas: well in regards to when entering numeric text in a textbox, what exactly do you want to raise for the other textbox Which event to do what
I don't know enough to really know.
To respond to both: When I enter text into Input_Box (example name) with the keyboard and hit enter or click somewhere else, I am rather cartain the an event is created somewhere than says the text in Input_Box has been updated. When that happens, I want another piece of code to get a copy of that text and put the same number into Display_Box. ( I will be doing more with it later.) How do I register a function to get that event Am I on the right track
TheJet
If you have a TextBox named say... textBox1 that contains the number 42 and want to extract that value and store it in a numeric variable you need to convert the contents of the TextBox as it stores its contents as a string.
In order to do this conversion and store the result in the variable num we need only:
int num = int.Parse(textBox1.Text);
To do this for more TextBoxes it’s just as trivial as changing the name of the TextBox.
Is this along the lines of what you are looking for