Impart Ant
Impart Ant
Impart Ant
sql connection
2. insert query
con.Open();
cmd.ExecuteNonQuery();
con.Close();
SqlDataAdapter da = new SqlDataAdapter("select *from HLTABLE", con);
con.Open();
da.Fill(ds, "HLTABLE");
dataGridView1.DataSource = ds.Tables["HLTABLE"];
con.Close();
4.interest calculate
5.key press
int isNumber = 0;
e.Handled = !int.TryParse(e.KeyChar.ToString(), out isNumber)
6.char press
7.image upload
add
cmd.Parameters.AddWithValue("@PHOTO",ImageData);
}
}
}
//catch (ArgumentException argumentexception)
catch (Exception ex)
{
MessageBox.Show("Photo Field Cannot Be Empty.Please
Upload Your Photo", "Warning", MessageBoxButtons.OK,
MessageBoxIcon.Stop);
}
return data1;
8.emi calculator
double a = Convert.ToDouble(textBox1.Text);
double b = Convert.ToDouble(textBox2.Text);
double c = Convert.ToDouble(textBox3.Text);
double TOTAL = a + (c / 100 * a);
double t = b * (c / 100 * a);
double d = TOTAL / b;
double f = 12 * (c / 100 * a);
textBox4.Text = Convert.ToString(d);
textBox5.Text = Convert.ToString(TOTAL);
textBox10.Text = Convert.ToString(t);
textBox11.Text = Convert.ToString(f);
9.radio button
if (RBMALE.Checked == true)
{
gender = "MALE";
}
else if (RBFEMALE.Checked == true)
{
gender = "FEMALE";
}
Add
cmd.Parameters.AddWithValue("@GENDER", gender);
10.date time
DateTime dt = Convert.ToDateTime(dateTimePicker1.Text);
(object creation)
add
cmd.Parameters.AddWithValue("@DATAOFBIRTH", dt);
11.digits accept
12.search
13.datagrid
14.total
double balance,a;
double CREDIT = Convert.ToDouble(TBTOTAL.Text);
double DEBIT = Convert.ToDouble(TBTOTAL1.Text);
balance = CREDIT - DEBIT;
tbbalance.Text = Convert.ToString(balance);
17.ckeck
}
else
{
account ac = new account();
ac.Show();
}
dataGridView1.DataSource = ds.Tables["ACTABLE"];
con.Close();
18.email validation
if (textBox1.Text == "")
{
errorProvider1.SetError(textBox1, "invalid");
return false;
}
else
{
errorProvider1.SetError(textBox1, "");
return true;
}
if (ValidEmail(textBox1.Text))
{
errorProvider1.SetError(textBox1, "");
}
else
{
errorProvider1.SetError(textBox1, "Error");
}
}
else
MessageBox.Show("invalid");
return (false);
}
}
19.number validation
return false;
}
else
{
return true;
}
}
else
{
return true;
}
}
20.textbox validation
21.delete
SqlCommand cmd = new SqlCommand("delete from staff where name=@name and id=@id",
con);
cmd.Parameters.AddWithValue("@name", textBox1.Text);
cmd.Parameters.AddWithValue("@id", textBox2.Text);
22.login validation
if(Validation())
{
if(textBox1.Text=="krishna" &&
textBox2.Text=="krishna")
{
empdisplayrorm frm=new empdisplayrorm();
frm.Show();
this.Hide();
}
else
{
label3.Visible=true;
}
}
23.validation
if (textBox1.Text=="")
{
errorProvider1.SetError(textBox1, "invalid");
return false;
}
else
{
errorProvider1.SetError(textBox1, "");
}
if (textBox1.Text=="")
{
errorProvider1.SetError(textBox1, "invalid");
return false;
}
else
{
errorProvider1.SetError(textBox1, "");
}
return true;
}
return true;
}
24.clear
Tbname.text=””
24.timer
{
DateTime t = DateTime.Now;
SqlCommand cmd = new SqlCommand("insert into table_1
values(@name,@logintime)",con);
cmd.Parameters.AddWithValue("@name",textBox1.Text);
cmd.Parameters.AddWithValue("@logintime",t);
//textBox2.Text = Convert.ToString(t);
con.Open();
cmd.ExecuteNonQuery();
MessageBox.Show("succed");
textBox2.Text = Convert.ToString(t);
con.Close();
}
And datatype dati time and add timer to form design
25.update
if (textBox1.Text.Length < 10 )
{
MessageBox.Show("please enter minimum 10 digits");
return false;
}
else
{
return true;
}
30.binding