I have an application that contains a textbox wherein my database could only accept an int value, which is the contact number. The contact number field is only optional, so an empty field couldn't be accepted because it's still a character and not a number. How could I fix this? Need help.
AngelicOne 4 Posting Whiz
Recommended Answers
Jump to PostYou may also like to read this: http://msdn.microsoft.com/en-us/library/1t3y8s4s(v=VS.80).aspx
Jump to PostCan you insert 0 (zero) instead of nothing (in case if user does not insert a number)?
I was thinking of using this code then:string strValue = textBox1.Text.Trim(); int intValue = 0; if (strValue != String.Empty) intValue = Convert.ToInt32(strValue); else intValue = 0;
All 8 Replies
Momerath 1,327 Nearly a Senior Poster Featured Poster
ddanbe 2,724 Professional Procrastinator Featured Poster
Mitja Bonca 557 Nearly a Posting Maven
AngelicOne 4 Posting Whiz
Mitja Bonca 557 Nearly a Posting Maven
AngelicOne 4 Posting Whiz
AngelicOne 4 Posting Whiz
Mitja Bonca 557 Nearly a Posting Maven
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.