473,394 Members | 1,841 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,394 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 1025

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...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.