1 / 7

Auto Counter

Auto Counter. The invention of K.G.Ishan Poorna. software. 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 ; using System.Data.SqlClient ;

dooley
Download Presentation

Auto Counter

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Auto Counter The invention of K.G.Ishan Poorna

  2. software 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; using System.Data.SqlClient; namespace WindowsFormsApplication6 { public partial class ishan : Form { SqlConnection con = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=C:\\Users\\ditec\\Documents\\Visual Studio 2008\\Projects\\WindowsFormsApplication6\\WindowsFormsApplication6\\Database1.mdf;Integrated Security=True;User Instance=True"); int n; public ishan() { InitializeComponent(); } private void pictureBox1_Click(object sender, EventArgs e) { progressBar1.Visible = true; con.Open(); SqlCommandcmd = new SqlCommand("DELETE FROM AutoCounter", con); cmd.ExecuteNonQuery(); con.Close(); progressBar1.Value = 10; System.Threading.Thread.Sleep(400); if (progressBar1.Visible = true) { dataGridView1.Visible = false; } progressBar1.Value = 22; System.Threading.Thread.Sleep(90); progressBar1.Value = 50; System.Threading.Thread.Sleep(40); progressBar1.Value = 75; System.Threading.Thread.Sleep(400); progressBar1.Value = 90; System.Threading.Thread.Sleep(600); progressBar1.Value = 100; if (MessageBox.Show("Do you want to exit?", "My Application", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { Application.Exit(); progressBar1.Visible = false; } } private void label1_Click(object sender, EventArgs e) { } private void label1_Click_1(object sender, EventArgs e) { } private void dataGridView1_CellContentClick_1(object sender, DataGridViewCellEventArgs e) { } private void pictureBox5_Click(object sender, EventArgs e) { } } }

  3. First steps private void Form1_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'database1DataSet.AutoCounter' table. You can move, or remove it, as needed. this.autoCounterTableAdapter.Fill(this.database1DataSet.AutoCounter); timer1.Start(); textBox2.Text = "0"; }

  4. For TIME private void timer1_Tick(object sender, EventArgs e) { textBox1.Text = (DateTime.Now).ToString(); }

  5. For count private void Form1_MouseUp(object sender, MouseEventArgs e) { con.Open(); string time = textBox1.Text; int a = Convert.ToInt32(textBox2.Text); a = a + 1; textBox2.Text = Convert.ToString(a); SqlCommandcmd = new SqlCommand("INSERT INTO AutoCounter(number,time) VALUES('" + a + "','" + time + "')", con); cmd.ExecuteNonQuery(); con.Close(); }

  6. Store in date base private void q(object sender, KeyPressEventArgs e) {dataGridView1.Visible = true; panel2.Visible = true; pictureBox1.Visible = true; textBox1.Visible = true; textBox2.Visible = true; label1.Visible = true; panel1.Visible = true; pictureBox2.Visible = true; pictureBox3.Visible = true; con.Open(); SqlCommand comm3 = new SqlCommand("select*from AutoCounter", con); SqlDataReader reader = comm3.ExecuteReader(); while (reader.Read()) { dataGridView1.Rows.Add(); dataGridView1.Rows[n].Cells[0].Value = reader[0]; dataGridView1.Rows[n].Cells[1].Value = reader[1]; n++; } con.Close();

  7. for end

More Related