Question

I am trying to complete Chapter 9 exercise 9 in C# Programming: From Problem Analysis to...

I am trying to complete Chapter 9 exercise 9 in C# Programming: From Problem Analysis to Program Design. I have both first name and last name textboxes, an account number textbox, and an initial balance textbox. I need to make error messages when the user doesnt enter their info, but can't figure out the if statements that i need to use. What would you suggest? Thanks

0 0
Add a comment Improve this question Transcribed image text
Answer #1

//Place this code under button click function.

if (!System.Text.RegularExpressions.Regex.IsMatch(txtFirstName.Text, "[^A-Z|^a-z|^ |^\t]"))
{
if (!System.Text.RegularExpressions.Regex.IsMatch(txtLastName.Text, "[^A-Z|^a-z|^ |^\t]"))
{
if (!System.Text.RegularExpressions.Regex.IsMatch(txtAccNo.Text, "[^0-9|^ |^\t]"))
{
if (!System.Text.RegularExpressions.Regex.IsMatch(txtBalance.Text, "[^0-9|^ |^\t]"))
{
MessageBox.Show("Validation Success");
}
else
{
MessageBox.Show("Invalid balance");
}
}
else
{
MessageBox.Show("Invalid account number");
}
}
else
{
MessageBox.Show("Invalid lastname");
}
}
else
{
MessageBox.Show("Invalid firstname");
}

Add a comment
Know the answer?
Add Answer to:
I am trying to complete Chapter 9 exercise 9 in C# Programming: From Problem Analysis to...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I need help writing a C programming code. I am trying to create a program that...

    I need help writing a C programming code. I am trying to create a program that returns ANY given number's decimal value as an Integer (Whole number). Examples: User input: 0.35 Output: 35 User input: 1.465 Output: 465 User input: 10.6054 Output: 6054

  • Book: C++ Programming From Problem Analysis to Program Design Chapter: 13 Problem Number: 14 Program Please...

    Book: C++ Programming From Problem Analysis to Program Design Chapter: 13 Problem Number: 14 Program Please help to clarify this problem. It would be greatly appreciated. Thanks

  • Hi, I am trying to convert a string vector to a double vector in c++ ,...

    Hi, I am trying to convert a string vector to a double vector in c++ , but for some reason I am getting this error message. Hope you can help! Thanks error: cannot convert ‘std::string {aka std::basic_string<char>}’ to ‘const char*’ for argument ‘1’ to ‘double atof(const char*)’ double salary = atof(info[x].stringsalary); my code is... void display(vector<Employee_Data>& info){ double total = 0; cout << "id" <<setw(25) <<"first name" <<setw(25) <<"last name" <<setw(25) <<"gender" <<setw(25) <<"department" <<setw(25) <<"salary" << endl ; for(int...

  • Hello I am trying to solve Problem 27.J. This is a problem from real analysis course....

    Hello I am trying to solve Problem 27.J. This is a problem from real analysis course. Thanks 27.J. Give an example of a continuous function with a unique relative maximum. . point but such that the derivative does not exist at this point. C a avamale of a uniformly continuous function which is differenti- VC

  • c# Instructions In Chapter 5, you wrote a HomeSales application for three salespeople: Danielle, Edward, and...

    c# Instructions In Chapter 5, you wrote a HomeSales application for three salespeople: Danielle, Edward, and Francis. Now, using the code you wrote in Chapter 5, Programming Exercise 5, modify the program to use arrays to store the salesperson names, allowed initials, and accumulated sales values. In order to prepend the $ to currency values, the program will need to use the CultureInfo.GetCultureInfo method. In order to do this, include the statement using System. Globalization; at the top of your...

  • C# Temp. Converter program. Create a Celsius and Fahrenheit Temperature Converter application. The application must have...

    C# Temp. Converter program. Create a Celsius and Fahrenheit Temperature Converter application. The application must have 2 Labels (each one of them assigned only to Celsius and Fahrenheit), 2 TextBoxes (each one of them assigned only to Celsius and Fahrenheit), only 1 Convert Button, 1 Clear Button, and 1 Exit Button. Also, 1 Error message label which will display the error messages. The application should only allow the user to enter the desired temperature just in one of the TextBoxes...

  • C# Temperature Converter Application: I have most of the application complete I just need only help...

    C# Temperature Converter Application: I have most of the application complete I just need only help with error messages. My instructor wants me to show four error messages inside an error message label (not a message box) and all of the error messages should appear inside error message label. The four error messages should appear when: 1: User enters data inside both Celsius and fahrenheit text boxes: “You should enter data in only one textbox. Press Clear to start over.”...

  • qbasic is the programming language Chapter 8 Do Programming Exercise 8-3 om page 414. Create a...

    qbasic is the programming language Chapter 8 Do Programming Exercise 8-3 om page 414. Create a string array to hold the months of the year. Call it anything you want to just make sure it's a string array is at the end of the name, e.g. months). Create a DATA statement that holds the month names: DATA "jan","Feb", "Mar" etc. Next you'll need a FOR loop to READ the DATA into the array, Call a SUB to get the rainfall...

  • Please use C programming to write the code to solve the following problem. Also, please use the i...

    Please use C programming to write the code to solve the following problem. Also, please use the instructions, functions, syntax and any other required part of the problem. Thanks in advance. Use these functions below especially: void inputStringFromUser(char *prompt, char *s, int arraySize); void songNameDuplicate(char *songName); void songNameFound(char *songName); void songNameNotFound(char *songName); void songNameDeleted(char *songName); void artistFound(char *artist); void artistNotFound(char *artist); void printMusicLibraryEmpty(void); void printMusicLibraryTitle(void); const int MAX_LENGTH = 1024; You will write a program that maintains information about your...

  • I am trying to build a program in Visual Basic that allows user to enter an...

    I am trying to build a program in Visual Basic that allows user to enter an objects mass and velocity and to display the Kinetic energy. The application should have a function KineticEnergy that accepts a moving objects mass and velocity as arguments. The function should return the objects KE. i get these three errors when trying to run the program I need help how would I fix this so it runs successfully? Thanks in advance! Start 16 ml.vb* +...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT