public stockview() { commoditymodel cm = new commoditymodel(); InitializeComponent(); autocomplete.fillcombo(cmbuom, "u_sym", "uom"); OleDbDataReader dr = cm.getcom(); while (dr.Read()) { stockdata sd = new stockdata() { Cid = int.Parse(dr.GetValue(0).ToString()), Cname = dr.GetValue(1).ToString(), Cuom = dr.GetValue(2).ToString(), Cpp = dr.GetValue(3).ToString(), Csp = dr.GetValue(4).ToString(), Copstock = dr.GetValue(5).ToString(), Cbalstock = dr.GetValue(6).ToString() }; sc.Add(sd); } listBox1.ItemsSource = sc; }
private void listBox1_MouseDoubleClick(object sender, MouseButtonEventArgs e) { textBox1.ClearValue(TextBox.BorderBrushProperty); s = (stockdata)listBox1.SelectedValue; txtconame.Text = s.Cname; txtcmb.Text = s.Cuom; txtcopp.Text = s.Cpp; txtcosp.Text = s.Csp; txtcoops.Text = s.Copstock; txtbalstock.Text = s.Cbalstock; edittoggle(false); save.Visibility = Visibility.Hidden; can_edit.Visibility = Visibility.Visible; txtcoops.IsEnabled = false; dpdate.IsEnabled = false; btn_update.Visibility = Visibility.Hidden; }