Hi everyone,
For my Assignment I have to use C# in order to create a validation form and include the following things to register and validate: Email Address, Username, Password, Retype Password, and a Submit Button. I have figured out some of the code for the Email Address validation:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Validation4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
bool IsValidEmail(string email)
{
try
{
var addr = new System.Net.Mail.MailAddress(email);
return addr.Address == email;
}
catch
{
return false;
}
if (textBox1.Text == " ")
MessageBox.Show("Enter Some Text in TextBox1");
}
}
private void textBox3_TextChanged(object sender, EventArgs e)
{
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
}
private void textBox4_TextChanged(object sender, EventArgs e)
{
}
}
}
But I am not quite sure how to code for the other necessary parts of the assignment. Here is the actual Assignment:
Using the appropriate tool for your language, (as noted above), implement a user interface that allows the user to enter data. You can create the interface based on your Unit 5 wireframe, or you can create a new interface. Validate the data according to your data validation plan. When the user interface is complete, ask at least one person to use the interface and provide feedback. Test that your data validation plan is implemented and working correctly. Record the results of your test.
For the test, ask the user to enter both correct and incorrect data and both correct and incorrect formats to demonstrate that validation is working. Your test report should list each input provided by the user and the result.
Please let me know if you need a copy of my validation plan paper.
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void label1_Click(object sender, EventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void textBox1_Leave(object sender, EventArgs e)
{
try
{
new System.Net.Mail.MailAddress(this.textBox1.Text);
}
catch (ArgumentException)
{
MessageBox.Show("Invalid Email");
}
catch (FormatException)
{
MessageBox.Show("Invalid Email");
}
}
private void textBox2_Leave(object sender, EventArgs e)
{
if(this.textBox2.Text=="")
MessageBox.Show("Invalid Username");
}
private void textBox3_Leave(object sender, EventArgs e)
{
if (this.textBox3.Text == "")
MessageBox.Show("Invalid Password");
}
private void textBox4_Leave(object sender, EventArgs e)
{
if (this.textBox4.Text == "" || this.textBox4.Text !=
this.textBox3.Text)
MessageBox.Show("Password should match");
}
private void button1_Click(object sender, EventArgs e)
{
if (this.textBox2.Text == "")
MessageBox.Show("Invalid Username");
try
{
new System.Net.Mail.MailAddress(this.textBox1.Text);
}
catch (ArgumentException)
{
MessageBox.Show("Invalid Email");
}
catch (FormatException)
{
MessageBox.Show("Invalid Email");
}
if (this.textBox4.Text == "" || this.textBox4.Text !=
this.textBox3.Text)
MessageBox.Show("Password should match");
if (this.textBox3.Text == "")
MessageBox.Show("Invalid Password");
this.Controls.Clear();
this.InitializeComponent();
}
private void textBox3_Click(object sender, EventArgs e)
{
textBox3.Text = "";
textBox3.PasswordChar = '*';
}
private void textBox4_Click(object sender, EventArgs e)
{
textBox4.Text = "";
textBox4.PasswordChar = '*';
}
}
}




/*PLEASE HIT LIKE BUTTON ,IF THIS ANSWER HELPS .... BEST WISHES */
Hi everyone, For my Assignment I have to use C# in order to create a validation...
Looking for some help here: Edit GetPhoneData to add more input validation by setting ranges for values Brands (Samsung, iPhone, Google) Models (Galaxy, Note, 8, X, Pixel) Price ($0.01-$2000) Include a comment about your addition, you can be creative, add components (or not), individualize this. Extra Credit (Samsung must be paired to Galaxy or Note) 2 points Below is the code: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace Cell_Phone_Test {...
C# Windows Form Application (CALCULATOR): (This is the instruction below): Windows Calculator that will going to create a Windows Form Application that will mimics a calculator. This is the screenshot how it shouldl look like. Calculator It should have a textbox and the following buttons: + Addition - Subtraction * Multiplication / Division = Equals (Will perform the final calculation) C Clear (Will clear the text box) There will be no maximize or minimize buttons. The rules are these: 2...
7 1.5 By organizing reusable codes to a C++ class named "Sample.cpp", which of the following is the correct way to import the reusable codes to another C++ file named "Test.cpp"? #define "Sample.cpp" #include "Sample.cpp" #copy "Sample.cpp" #using "Sample.cpp" #import "Sample.cpp" 28 1.5 Given the following code, which can assign "appletree" to the "textBox1" control as caption? TextBox textBoxl; textBox1-> Caption="appletree"; textBox1.Text ="appletree"; textBox1.Caption="appletree"; textBox1.Text = "appletree"; textBox1-> Caption("appletree"); 109 1.5 Given the following code, which can register a "SelectedIndexChanged"...
I am new to programming (2 weeks of playing with it) I have written code for a timer in Visual Studio 2013. I am wondering if someone can show me how to write code/what the code would look like in a MODULE1.vb. I was thinking that for this timer I could create MsgBox using a DO UNTIL LOOP that would pop up every 20 seconds that says "hurry up!" until 1 minute has passed. As I said I am just...
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.”...
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#
I am having trouble this program. So far my temperature
converter program is converting temps from C to F. However,
whenever I try to convert F to C, it's keep crashing and displaying
an error message, which I can not figure it out and do not know how
to fix it. Attached are two screenshots are of message. Do you know
what is causing the issue? I would much appreciate your
assistance.
namespace Temp Conv
{
public partial class...
How can I add this function to my C# code?:
Validate that if the user clicks the “OK” button, a “Seating
Category” is selected, and at least one ticket is being purchased.
If not, pop-up a dialog box asking the user to enter the needed
data for the transaction. What we want to avoid is depicted in See
Figure 3.
Figure 3:
This code asks for a seating category to be selected, how many
tickets to be purchased, and if...
how to add methods into thjs code using C# on visual
studio?
-validatetextbox should return a true false depending if input
is valid
-resetinput should clear all input and restart radiobuttons to
the defult positions
-displaymessge must display messge box to the user displaying
such as “5+8=12”
calculator.cs x Prearam S Miscellaneous Files ator.Designer.c s Calculato 1 曰using Systemi 2 using System.Collections.Generic; using System.ComponentModel; 4 using System.Data; s using System.Drawing; 6 using System.Linq 7using System.Text; 8 using System.Threading.Tasks; 9 using...
In the "Go" button add 15 random numbers in the array using a random number generator. Remove the call to "SetToZero" and the code following. Remove the "SetToZero" method. Add Access Keys of your choice Assign an accept button Assign cancel button (Exit) Add a Button "Find Max" Write an appropriately named method that Accepts the array Finds the largest int and returns the value "Find Max" button click Calls above method Opens a MessageBox to display the returned value...