private void butLietke_Click(object sender, System.EventArgs e) { if (!kiemtra()) { return; } if (d.get_paid(s_mabn, l_mavaovien, l_maql, l_idkhoa, s_ngay)) { MessageBox.Show(lan.Change_language_MessageText("Người bệnh này đã thanh toán !"), LibMedi.AccessData.Msg); return; } if (bTTngay) { MessageBox.Show("Ngày " + s_ngay + " viện phí đã in danh sách thu tiền\nYêu cầu chọn phiếu buổi chiều !", LibMedi.AccessData.Msg); return; } i_madoituong = d.get_madoituong(l_maql); frmChonchidinh f = new frmChonchidinh(m, s_mabn, i_madoituong, s_loaivp, s_mucvp, v.iNoitru, s_sothe, v1, v2, true, l_mavaovien); f.ShowDialog(this); if (f.dt.Rows.Count > 0) { madoituong.SelectedValue = i_madoituong.ToString(); madoituong.Update(); foreach (DataRow r in f.dt.Rows) { l_id = v.get_id_vpkhoa; v.upd_vpkhoa(l_id, s_mabn, l_mavaovien, l_maql, l_idkhoa, s_ngay, s_makp, i_madoituong, int.Parse(r["mavp"].ToString()), 1, decimal.Parse(r["dongia"].ToString()), decimal.Parse(r["vattu"].ToString()), i_userid, i_buoi); d.upd_theodoicongno(d.insert, s_mabn, l_mavaovien, l_maql, l_idkhoa, i_madoituong, decimal.Parse(r["dongia"].ToString()) + decimal.Parse(r["vattu"].ToString()), "vienphi"); m.updrec_chidinh(ds.Tables[0], l_id, s_ngay, s_makp, "", i_madoituong, madoituong.Text, int.Parse(r["mavp"].ToString()), r["ten"].ToString(), r["dvt"].ToString(), 1, decimal.Parse(r["dongia"].ToString()), decimal.Parse(r["vattu"].ToString()), 0, 0, 0, 0, ""); } } ref_text(); }
Boolean SetList(ComboBox cb, IEnumerable data) { if (cb == null || data == null) return false; try { if (!(data is IList)) { List<Object> list = new List<Object>(); foreach (Object item in data) { list.Add(item); } data = list; } cb.DataSource = data; //cb.DisplayMember = "value"; cb.Update(); return true; } catch (Exception ex) { XTrace.WriteException(ex); return false; } }
public static void autocomplete_place_combobox(System.Windows.Forms.ComboBox combobox) { try { if (combobox.Text == "") { } else { int h = combobox.SelectionStart; string[] splitted = combobox.Text.Split(' '); int count = splitted.Length; string finalparam = null; for (int i = 0; i < count; i++) { finalparam = finalparam + "+" + splitted[i]; } Uri target = new Uri("https://maps.googleapis.com/maps/api/place/autocomplete/json?input=" + finalparam.Remove(0, 1) + "&components=country:LK&key=AIzaSyA5adm56fjZXi9IDLbhWw9U7ZYhCif137c&sessiontoken=1234567890"); WebRequest request = WebRequest.Create(target); request.Method = "GET"; request.ContentType = "application/x-www-form-urlencoded"; StreamReader responseReader = new StreamReader(request.GetResponse().GetResponseStream()); string response = responseReader.ReadToEnd(); JObject o = JObject.Parse(response); places = o; //MessageBox.Show(o.ToString()); string[] suggestions = new string[10]; int j = 0; while (j < 10) { try { suggestions[j] = o["predictions"][j]["description"].ToString(); j++; } catch (System.ArgumentOutOfRangeException x) { break; } } combobox.DataSource = suggestions; combobox.Update(); combobox.SelectionStart = h; //MessageBox.Show(o["predictions"][0]["description"].ToString()); } } catch (System.Net.WebException) { MessageBox.Show("Network Failure (Make sure you are connected to the internet)", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void button_click(object sender, EventArgs e) { lista.Update(); lista2.Update(); string el1 = lista.SelectedItem.ToString(); string el2 = lista2.SelectedItem.ToString(); listaOdw.Clear(); graph22 = new Microsoft.Msagl.Drawing.Graph(); //listaOdw.Add(el1); string wynik = wyszukaj(el1, el2, el1); Console.WriteLine(wynik); }
private void olvCellEditStarting(object sender, CellEditEventArgs e) { Console.WriteLine("LKLJKLJKL"); List<String> countries = new List<String> {"testi", "joku", "Hiiri"}; ComboBox cboCombo = new ComboBox(); cboCombo.Bounds = e.CellBounds; cboCombo.Left = e.CellBounds.Left + 1; cboCombo.Width = e.CellBounds.Width - 1; cboCombo.DropDownStyle = ComboBoxStyle.DropDownList; cboCombo.DisplayMember = "Display"; cboCombo.ValueMember = "ID"; cboCombo.DataSource = countries; cboCombo.AutoCompleteSource = AutoCompleteSource.ListItems; cboCombo.AutoCompleteMode = AutoCompleteMode.SuggestAppend; cboCombo.Update(); //int intComboEditorSelectedValue = countries.Find(item => item.Display == (string)(e.Value)).ID; e.Control = cboCombo; cboCombo.SelectedValue = intComboEditorSelectedValue; //fails silently /* if (e.Column.Text != "Seura") return; ComboBox cb = new ComboBox(); cb.Bounds = e.CellBounds; cb.Font = ((ObjectListView)sender).Font; cb.DropDownStyle = ComboBoxStyle.DropDownList; cb.Items.AddRange(new String[] { "Pay to eat out", "Suggest take-away", "Passable", "Seek dinner invitation", "Hire as chef" }); cb.SelectedIndex = ((int)e.Value) / 10; //cb.SelectedIndexChanged += new EventHandler(cb_SelectedIndexChanged); cb.Tag = e.RowObject; // remember which person we are editing e.Control = cb; * * */ }
public void BindTemplate(ComboBox cb) { var list = new List<String>(); foreach (var item in Engine.FileTemplates) { list.Add("[文件]" + item); } foreach (String item in Engine.Templates.Keys) { String[] ks = item.Split('.'); if (ks == null || ks.Length < 1) continue; String name = "[内置]" + ks[0]; if (!list.Contains(name)) list.Add(name); } cb.Items.Clear(); cb.DataSource = list; cb.DisplayMember = "value"; cb.Update(); }
public void ComboVendedor(ComboBox combobox) { combobox.DataSource = CarregaComboIDVendedor(); combobox.ValueMember = "VEND_ID"; combobox.DisplayMember = "FUNC_NOME"; combobox.Update(); }