Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
4
Reply
If Statment
Priya M
Feb 3 2016 7:15 AM
447
Reply
hello
i want to run this code,where all fields is not null then Query will be Executed,if not then message will be displayed
private bool IsValidationSuccess()
{
try
{
if (string.IsNullOrEmpty(txtCompanyName.Text.Trim())
&& string.IsNullOrEmpty(txtCompanyAddress1.Text) &&string.IsNullOrEmpty(txtPincode.Text.Trim())
&& cmbDistrict.SelectedIndex <=0 && cmbTaluka.SelectedIndex <=0)
{
return false;
}
else
{
return true ;
}
}
catch (SqlException ex)
{
throw ex;
}
//on button click
if (IsValidationSuccess())
{
AddCompanyDetails();
}
else
{
MessageBox.Show("Please fill Compulsary(*) field");
}
///////////////////////////////
error:when all field contain data it returns false,and message box is displayed .
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
4
)
Next Recommended Forum
Plugin and Extension in C# .Net
Fire Timer Tick Event even when page is not loading