puneet ahooja

puneet ahooja

  • 1.6k
  • 97
  • 20.4k

How to Validate Activation Key and proceed to Login Form

Dec 7 2015 5:31 AM
Hi Friends,
 
i want to know how to validate the activation key and proceed to Next form i.e. Login Form.
 
I am developing the forms.
 
Can Anyone helps;
 
Here is the code:
 
private void button1_Click(object sender, EventArgs e)
{
try
{
if (Convert.ToInt32(textBox1.Text) + Convert.ToInt32(textBox2.Text) + Convert.ToInt32(textBox3.Text) + Convert.ToInt32(textBox4.Text) + Convert.ToInt32(textBox5.Text) == 1000)
MessageBox.Show(" Key Sucessfully Activated!");
login obj = new login();
obj.Show();
this.Hide();
else
MessageBox.Show("Enter Correct Key Number ");
}
catch (System.FormatException ex)
{
MessageBox.Show("Error! Activation Key contain Numbers");
}
}
 
HERE IS THE ERRORS : 
 
Error 1 Only assignment, call, increment, decrement, and new object expressions can be used as a statement D:\VS Projects\AMC\amc\amc\LicenceKey.cs 35 32 amc
 
Error 2 Invalid expression term 'else' D:\VS Projects\AMC\amc\amc\LicenceKey.cs 39 17 amc
 
Error 3 ; expected D:\VS Projects\AMC\amc\amc\LicenceKey.cs 39 21 amc
 
 
 

Answers (3)