private void listView1_MouseDoubleClick(object sender, MouseEventArgs e) { TripAdd tadd = new TripAdd(); SQLiteConnection scn = new SQLiteConnection(@"data source = main.db"); scn.Open(); SQLiteCommand sq; sq = new SQLiteCommand("select * from Trips where Tripno = '" + listView1.SelectedItems[0].Text + "'", scn); SQLiteDataReader dr = sq.ExecuteReader(); tadd.truckdetails.Items.Clear(); while (dr.Read()) { tadd.isNew = false; tadd.invoiceno.Text = listView1.SelectedItems[0].Text; tadd.customername.Items.AddRange(Sqlite.LoadClients()); tadd.customername.Text = dr["Name"].ToString(); tadd.from.Text = dr["Froom"].ToString(); tadd.to.Text = dr["Tao"].ToString(); tadd.comments.Text = dr["Comments"].ToString(); tadd.dateTimePicker1.Text = dr["Date"].ToString(); tadd.status = dr["Status"].ToString(); tadd.Qty.Text = dr["Qty"].ToString(); tadd.amount.Text = dr["Amount"].ToString(); tadd.typebox.Text = dr["Type"].ToString(); tadd.other.Text = dr["Other"].ToString(); } sq = new SQLiteCommand("select * from TripDetails where Tripno = '" + listView1.SelectedItems[0].Text + "'", scn); dr = sq.ExecuteReader(); while (dr.Read()) { tadd.truckdetails.Items.Add(new ListViewItem(new[] { dr["Truckno"].ToString(), dr["Weight"].ToString(), dr["Location"].ToString(), dr["Qty"].ToString(), dr["Amount"].ToString() })); } tadd.ShowTrucksQty(); tadd.Show(); }
private void button1_Click(object sender, EventArgs e) { TripAdd tadd = new TripAdd(); tadd.Show(); }