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 PostWhy are you using a Textbox? Just use a NumericUpDown control with the default set to 0. Not only will this correct your immediate problem, it also saves you all kinds of trouble in verifying that the "values" are actually numeric.
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
4,695
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.