473,382 Members | 1,658 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

what is the proper if else statement of this.

What is the proper if else statement of this:

Expand|Select|Wrap|Line Numbers
  1. private void btnSave_Click(object sender, EventArgs e)
  2. {
  3.   if (txtID.Text.Trim()== "")
  4.   {
  5.     labelID.Text = "!";
  6.   }
  7.  
  8.   if (txtLastName.Text.Trim()=="")
  9.   {
  10.     labelLN.Text = "!";
  11.   }
  12.   if (txtFirstName.Text.Trim()=="")
  13.   {
  14.     labelFN.Text = "!";
  15.   }
  16.   if (txtMiddleName.Text.Trim()=="")
  17.   {
  18.     labelMI.Text = "!";
  19.   }
  20.   else
  21.   {
  22.     DialogResult dialogresult = MessageBox.Show("Successfully save.", "Books",MessageBoxButtons.OK, MessageBoxIcon.Question);
  23.     if (dialogresult == DialogResult.Yes)
  24.     {
  25.       string myCon = ...;
  26.       string Query = ....
  27.  
  28.       try
  29.       {
and if the textbox is not empty , label should not seen.
Nov 20 '14 #1
0 1023

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: CMAR | last post by:
I create my website using Front Page 2000. I notice that none of my pages have a DocType statement at the top. I have read that if you want IE6 to use "Standards mode" rather than the "Quirks...
6
by: Daniel Rudy | last post by:
What is wrong with this program? When I try to compile it, I get the following error. Compiler is gcc on FreeBSD. strata:/home/dcrudy/c 1055 $$$ ->cc -g -oe6-3 e6-3.c e6-3.c: In function...
18
by: swaroophr | last post by:
Which of switch statement and if-else statement takes less time to execute?
2
by: paul | last post by:
Hi all, I've been handed some code and, unless I've got the numbering of parentheses wrong, one of the functions has a curious if-else statement. The thing compiles but is it right? I know the...
2
by: juan-manuel.behrendt | last post by:
Hello together, I wrote a script for the engineering software abaqus/CAE. It worked well until I implemented a selection in order to variate the variable "lGwU" through an if elif, else...
4
by: maveri4201 | last post by:
I have written a php script (test3.php), which I attached as a text file. Its includes are also attached as text files. I'm trying to run the script here: http://www.wondergy.com/phptestbed/test3.php...
6
by: DanicaDear | last post by:
I have this update strSQL that is working great, but I'd like to make it smarter in hopes of preventing input errors. Here is my working code: Else Me.txtScan_Box_Num =...
1
by: Joshua Billings | last post by:
I am working on a programming assignment, and I can't figure out what is wrong with these lines of code. if ad > 6: rectAD.setFill("red") if ad <= 3: rectAD.setFill("red") else: ...
5
Seth Schrock
by: Seth Schrock | last post by:
I'm using SQL in VBA to check if a checkbox is checked or not. I don't get any compilation errors, but when I run the code (On click event for a button), it says "Type mismatch" and doesn't error...
4
by: tastingoo | last post by:
Hi, I'm having problems accessing the worksheet after creating the worksheet in an IF statement. For some reason, if I create the worksheet in the else statement, my $rxsheet address is gone...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.