say im performing addition of two numbers.
there are three textboxes . 2 for entering the numbers and 1 for displaying the result.
im giving one value in first text box and no value in second textbox
it says "conversion not possible". now wat shuld i do to make the value as 0 in a textbox automatically if no value is entered in textbox.
killer88 0 Light Poster
Recommended Answers
Jump to Posti hop do by simple checking the value of the textbox
Dim num1 As Short
If TextBox1.Text.Equals("") Then num1 = 0 End If
hop this help ;)
Jump to PostAn simpler way,
Dim num1 as Double = Val(TextBox1.Text)
the Val function returns a double, but if you need it to be an Integer, you can convert it to Integer,Dim num1 as Integer = Convert.ToInt16(Val(TextBox1.Text))
It will convert any string representation of a number to a number, and if …
All 7 Replies
ardi_lucy 0 Newbie Poster
deceptikon 1,790 Code Sniper Team Colleague Featured Poster
xerohomicide 0 Newbie Poster
tinstaafl 1,176 Posting Maven
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
azareth 5 Posting Whiz in Training
killer88 0 Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.