+ 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

15th Nov 2018, 2:37 PM
Hariyanto Halim
Hariyanto Halim - avatar
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() }
16th Nov 2018, 1:04 AM
Hariyanto Halim
Hariyanto Halim - avatar
+ 2
r f thank you so much It's working now
16th Nov 2018, 11:32 AM
Hariyanto Halim
Hariyanto Halim - avatar
+ 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
15th Nov 2018, 7:53 PM
sneeze
sneeze - avatar