0% found this document useful (0 votes)
31 views2 pages

Process: Private Void Object

This document contains code snippets for three different tasks: 1) Shutting down a PC using C# by calling the shutdown command. 2) Authenticating a user by checking username and password against a database table. 3) Populating a data grid view with sample product data.

Uploaded by

kishor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views2 pages

Process: Private Void Object

This document contains code snippets for three different tasks: 1) Shutting down a PC using C# by calling the shutdown command. 2) Authenticating a user by checking username and password against a database table. 3) Populating a data grid view with sample product data.

Uploaded by

kishor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

////for shutdown pc in c#

System.Diagnostics.Process.Start("shutdown", "/s /t 0");

private void button1_Click_1(object sender, EventArgs e)


{

string strinsert = "select * from registration where emailid='" +


txtusername.Text + "' and passward='" + txtpassward.Text + "'";
DataTable dt = new DataTable();
dt = con.select(strinsert);

if (dt.Rows.Count > 0)
{

m.menuStrip1.Visible = true;
this.Close();
// r.Close();
}
else
{
MessageBox.Show("INVALID USERNAME AND PASSWARD");
}
}

%%%%%coding to database grdvw

private void Form1_Load(object sender, EventArgs e)


{
//dataGridView1.ColumnCount = 3;
//dataGridView1.Columns[0].Name = "Product ID";
//dataGridView1.Columns[1].Name = "Product Name";
//dataGridView1.Columns[2].Name = "Product Price";
//string[] row = new string[] { "1", "Product 1", "1000" };
//dataGridView1.Rows.Add(row);
//row = new string[] { "2", "Product 2", "2000" };
//dataGridView1.Rows.Add(row);
//row = new string[] { "3", "Product 3", "3000" };
//dataGridView1.Rows.Add(row);
//row = new string[] { "4", "Product 4", "4000" };
//dataGridView1.Rows.Add(row);
}
// FOR IMAGE INSERT

File.Copy(txtopen.Text,
Path.Combine(Application.StartupPath+"\\image", Path.GetFileName(txtopen.Text)),true);
label1.Text = "image saved successfully";
// pbopen.Image.Save(Application.StartupPath +
"\\IMAGE\\picture1.jpg");

You might also like