+ 5
Error when textbox empty
I'm using c# winform I made 1 textbox and 1 label. I use textchanged event. I use decimal variabel for textbox. When i input something in textbox, the label show what i input but when i delete the text in textbox, error message suddenly appear and the program can't run anymore
5 Respostas
+ 2
Txt1_textchanged
{
Decimal a, b, c,d;
b =decimal.parse(txt2.Text)
a = b * numericupdown.value
c = decimal.parse(txt3.text)
d = a - c
Label1.text = d.tostring()
}
+ 2
r f thank you so much
It's working now
+ 1
Can you please show us the code you use ?
The textchanged event fires everytime some thing is changed. Even when you are not finished changing.
Please explore this event a bit more using a listbox.
listbox1.items.add(textbox.text)
You wil see that every character is counted as a change.
c
ch
cha
chan
chang
change