how can validate empty data for text fields... i want to validate fields before inserting into database
Jump to Post
Comparing a string to "" actually compares with a string which has a length of zero. This is not the same thing as an empty string. Use instead String.IsNullOrEmpty() to test both cases
If String.IsNullOrEmpty(TextBox1.Text) OrElse String.IsNullOrEmpty(TextBox2.Text) Then MsgBox("Please Enter the text") Exit Sub End If
All 6 Replies
Be a part of the DaniWeb community
We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.