private void AutoCompletar() { List <CuentaDataSource> cuenta = new List <CuentaDataSource>(); try { cuenta = this.negocioCuenta.CargarCuenta(); } catch (Exception ex) { MessageBox.Show("SE PRESENTO UN ERROR." + ex.Message, "ERROR"); } AutoCompleteStringCollection cuentas = new AutoCompleteStringCollection(); foreach (CuentaDataSource item in cuenta) { cuentas.Add(item.Cuenta); } txt_cuenta.AutoCompleteCustomSource = cuentas; }
private void setDataForEmployId(string quarterId) { AutoCompleteStringCollection data = new AutoCompleteStringCollection(); if (quarterId.Equals("All")) { foreach (KeyValuePair <string, EmployeeModel> employ in busEmploy.convertDatatable2Dict()) { string employId = employ.Value.emPloyId.Trim(); data.Add(employId); } } else if (busEmploy.convertDatatableWithQuartId2Dict(quarterId).Count > 0) { foreach (KeyValuePair <string, EmployeeModel> employ in busEmploy.convertDatatableWithQuartId2Dict(quarterId)) { string employId = employ.Value.emPloyId.Trim(); data.Add(employId); } } searchEmployIdText.AutoCompleteCustomSource = data; }
void dgv预警_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e) { TextBox tb = (e.Control as TextBox); tb.AutoCompleteCustomSource = null; AutoCompleteStringCollection acsc; if (tb == null) { return; } switch (dgv预警.CurrentCell.OwningColumn.Name) { case "产品代码": acsc = new AutoCompleteStringCollection(); acsc.AddRange(ls产品代码.ToArray()); tb.AutoCompleteCustomSource = acsc; tb.AutoCompleteSource = AutoCompleteSource.CustomSource; tb.AutoCompleteMode = AutoCompleteMode.SuggestAppend; break; } }
private void Edit_Load(object sender, EventArgs e) { tbproduct1.AutoCompleteMode = AutoCompleteMode.Suggest; tbproduct1.AutoCompleteSource = AutoCompleteSource.CustomSource; AutoCompleteStringCollection pauto = new AutoCompleteStringCollection(); database.autocomplete("Product_Name", "PRODUCT", pauto); tbproduct1.AutoCompleteCustomSource = pauto; tbproduct2.AutoCompleteMode = AutoCompleteMode.Suggest; tbproduct2.AutoCompleteSource = AutoCompleteSource.CustomSource; AutoCompleteStringCollection pauto1 = new AutoCompleteStringCollection(); database.autocomplete("Product_Name", "PRODUCT", pauto); tbproduct2.AutoCompleteCustomSource = pauto1; tbproduct1.Text = ""; tbproduct2.Text = ""; tbqty.Text = ""; tbqty2.Text = ""; tbrate.Text = ""; }
private void txtNombre_Click(object sender, EventArgs e) { DbConnection conn = new DbConnection(true); List <string> lista = new List <string>(); foreach (Producto prod in conn.ObtenerTodosLosProductos()) { if (conn.Existencia(prod.Id) == true) { lista.Add(Convert.ToString(prod.Descripcion)); } } txtNombre.AutoCompleteMode = AutoCompleteMode.SuggestAppend; AutoCompleteStringCollection data = new AutoCompleteStringCollection(); data.AddRange(lista.ToArray()); txtNombre.AutoCompleteCustomSource = data; txtNombre.AutoCompleteSource = AutoCompleteSource.CustomSource; conn.Close(); txtNombre.Text = ""; txtCodigoBarras.Text = ""; }
public static void SetDataSource(System.Windows.Controls.ComboBox comboBox, params string[] stringArray) { try { if (stringArray != null) { Array.Sort(stringArray); AutoCompleteStringCollection col = new AutoCompleteStringCollection(); foreach (var item in stringArray) { col.Add(item); } comboBox.ItemsSource = col; } else { } } catch (Exception) { } }
/// <summary> /// metodo que llena un combo y pone autocompletar /// </summary> /// <param name="cbo"></param> public static void getProductosEnCbo(System.Windows.Forms.ComboBox cbo) { dsGimnasioTableAdapters.productoTableAdapter ta = new dsGimnasioTableAdapters.productoTableAdapter(); dsGimnasio.productoDataTable dt = ta.GetDataActivos(); dsGimnasio.productoDataTable dt2 = ta.GetDataActivos(); AutoCompleteStringCollection coleccion = new AutoCompleteStringCollection(); foreach (dsGimnasio.productoRow dr in dt2.Rows) { coleccion.Add(dr.Nombre); } cbo.DataSource = dt; cbo.ValueMember = "idProducto"; cbo.DisplayMember = "Nombre"; // Llenar el autocompletar cbo.AutoCompleteCustomSource = coleccion; cbo.AutoCompleteMode = AutoCompleteMode.Suggest; cbo.AutoCompleteSource = AutoCompleteSource.CustomSource; }
public Home() { InitializeComponent(); DateTime dateTime = DateTime.UtcNow.Date; label1.Text = DateTime.Now.ToString("MM/dd/yyyy" + " | | " + "hh:mm tt"); button1.Hide(); button2.Hide(); button3.Hide(); label2.Hide(); //List<String> admins = new List<String>(); //List<String> employees = new List<String>(); //data admin_name = new data(); //admin_name.add(admins, "Karan"); //admin_name.add(admins, "Max"); //admin_name.add(admins, "Jeff"); //data emp_name = new data(); //emp_name.add(employees, "Kobe"); //emp_name.add(employees, "Jordan"); //emp_name.add(employees, "Iverson"); //emp_name.add(employees, "Magic"); string[] users = new string[] { "Karan", "Michelle", "Max", "Jeff", "Ranier", "Augustin", "Kobe", "Jordan", "Iverson", "Magic" }; var source0 = new AutoCompleteStringCollection(); source0.AddRange(users); comboBox1.Items.AddRange(users); comboBox1.AutoCompleteCustomSource = source0; comboBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend; comboBox1.AutoCompleteSource = AutoCompleteSource.CustomSource; }
public void AutoValueAdd() { AutoCompleteStringCollection col = new AutoCompleteStringCollection(); try { string addvalueQuery = "select * from dbo.Customer_Management"; SqlCommand cmd = new SqlCommand(addvalueQuery, con); con.Open(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { col.Add(reader[0].ToString()); } reader.Close(); con.Close(); } catch (Exception ex) { } cid_txt.AutoCompleteCustomSource = col; }
// Fonction qui se déclenche juste avant l'affichage de la fenêtre private void IGérerUnSouhait_Load(object sender, EventArgs e) { // On récupère la liste des villes disponibles dans la base de données villes = contexteBaseImmobilly.VILLES.ToList(); // On veut suggérer des villes au fur-et-à-mesure que l'utilisateur saisit un nom de ville textBoxVilleSouhait.AutoCompleteMode = AutoCompleteMode.Suggest; textBoxVilleSouhait.AutoCompleteSource = AutoCompleteSource.CustomSource; // Une liste de suggestions ne peut pas être une liste d'objets "VILLES". // Seules les chaines de caractères sont acceptées. // On va donc convertir la liste des villes en liste de chaines de caractères. // Grâce au format de cette chaine (NOM_VILLE - CODE_POSTAL), il sera facile de retrouver le nom d'une ville, ainsi que son code postal par la suite. AutoCompleteStringCollection coll = new AutoCompleteStringCollection(); foreach (VILLES v in villes) { coll.Add(v.ToString()); } // On ajoute la liste des suggestions au champ de saisie. // Une liste de suggestions s'affichera sous le champ de saisie lorsque l'utilisateur tapera un nom de ville au clavier textBoxVilleSouhait.AutoCompleteCustomSource = coll; }
private void populateListPlaced(List <StudentPlacedDto> detailList) { var detailSet = new HashSet <StudentPlacedDto>(); isListPlacedLoaded = true; if (detailList != null && detailList.Count > 0) { listView_placed.SuspendLayout(); listView_placed.Items.Clear(); ListViewItem lv = null; var placedsSudentIds = new AutoCompleteStringCollection(); foreach (StudentPlacedDto dtoObj in detailList) { lv = new ListViewItem(dtoObj.collegeId); lv.SubItems.Add(dtoObj.name); lv.SubItems.Add(dtoObj.gender); lv.SubItems.Add(dtoObj.branch); lv.SubItems.Add(dtoObj.degree); lv.SubItems.Add(dtoObj.contact); lv.SubItems.Add(dtoObj.company); lv.SubItems.Add(Utility.getEnumValueByIndex(Constant.ENUM_COMPANY_TYPE, dtoObj.companyType)); lv.SubItems.Add(Utility.convertDateToString(dtoObj.dor)); lv.Tag = dtoObj; listView_placed.Items.Add(lv); detailSet.Add(dtoObj); placedsSudentIds.Add(dtoObj.collegeId); } listView_placed.ResumeLayout(); textBox_search.AutoCompleteCustomSource = placedsSudentIds; Utility.showToolTip(tooltip, label_tool1, detailSet.Count + Labels.STUDENTS, Constant.TOOLTIP_TYPE_INFO, Constant.TOOLTIP_FOUND); } else { listView_placed.Items.Clear(); Utility.showToolTip(tooltip, label_tool1, 0 + Labels.STUDENTS, Constant.TOOLTIP_TYPE_INFO, Constant.TOOLTIP_FOUND); } }
public void getData() { AutoCompleteStringCollection cols = new AutoCompleteStringCollection(); try { connection.Open(); SqlCommand cmd = new SqlCommand("Select * from tblSupplier", connection); SqlDataReader rd = cmd.ExecuteReader(); while (rd.Read()) { cols.Add(rd["SName"].ToString()); txtName.AutoCompleteCustomSource = cols; } connection.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); connection.Close(); } }
public void llenarse2(string tabla, string campo1, string campo2, string condicion2, string valorcon) { tbl = tabla; cmp1 = campo1; cmp2 = campo2; Cmb_auto.ValueMember = "numero"; Cmb_auto.DisplayMember = "nombre"; string[] items = cm.items2(tabla, campo1, campo2, condicion2, valorcon); for (int i = 0; i < items.Length; i++) { if (items[i] != null) { if (items[i] != "") { Cmb_auto.Items.Add(items[i]); } } } var dt2 = cm.enviar2(tabla, campo1, campo2, condicion2, valorcon); AutoCompleteStringCollection coleccion = new AutoCompleteStringCollection(); foreach (DataRow row in dt2.Rows) { coleccion.Add(Convert.ToString(row[campo1]) + "-" + Convert.ToString(row[campo2])); coleccion.Add(Convert.ToString(row[campo2]) + "-" + Convert.ToString(row[campo1])); } Cmb_auto.AutoCompleteCustomSource = coleccion; Cmb_auto.AutoCompleteMode = AutoCompleteMode.SuggestAppend; Cmb_auto.AutoCompleteSource = AutoCompleteSource.CustomSource; }
private void clientDropDown() { using (var db = new TravComEntities()) { var profiles = db.Profiles.Where(r => r.ProfileType == 0 && r.FullName != "").ToList(); AutoCompleteStringCollection col = new AutoCompleteStringCollection(); profiles.ForEach(item => { col.Add(item.FullName); //cmbBoxClient.Items.Add(item.FullName); }); cmbBoxClient.AutoCompleteSource = AutoCompleteSource.CustomSource; cmbBoxClient.AutoCompleteCustomSource = col; cmbBoxClient.AutoCompleteMode = AutoCompleteMode.Suggest; } }
private void Main_Load(object sender, EventArgs e) { pnlHome.BackColor = Color.FromArgb(100, 0, 0, 0); label1.BackColor = Color.FromArgb(100, 0, 0, 0); // TODO: This line of code loads data into the 'pMSDataSet.tblStocks' table. You can move, or remove it, as needed. //this.tblStocksTableAdapter.Fill(this.pMSDataSet.tblStocks); Login login = new Login(); login.Close(); obj.cmd = new SqlCommand("select ProductName from tblStocks", obj.con); obj.con.Open(); SqlDataReader dr = obj.cmd.ExecuteReader(); AutoCompleteStringCollection mycollaction = new AutoCompleteStringCollection(); while (dr.Read()) { mycollaction.Add(dr.GetString(0)); } txtSearchMedicine.AutoCompleteCustomSource = mycollaction; obj.con.Close(); }
public static AutoCompleteStringCollection get_dongia(string dvtt, string maloaivattu, string manhomvattu, int tamngung, int dacapnhap) { AutoCompleteStringCollection acst = new AutoCompleteStringCollection(); DataTable dt = DBConnection.GetDataByQuery($"call vu_get_dongia_bv('{dvtt}','{maloaivattu}','{manhomvattu}',{tamngung},{dacapnhap})"); if (dt != null) { foreach (DataRow dr in dt.Rows) { string info = dr[0].ToString().Replace(",", ""); //string d_info = double.Parse(info).ToString("G29"); if (info.Contains(".")) { info = info.TrimEnd('0'); info = info.TrimEnd('.'); } acst.Add(info); } } return(acst); }
private void AutoCompleteText() { SQLiteCommand cm = new SQLiteCommand(); cm.Connection = CurrentInfo.cn; SQLiteDataReader reader; textBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend; textBox1.AutoCompleteSource = AutoCompleteSource.CustomSource; AutoCompleteStringCollection AutoCompeleteString = new AutoCompleteStringCollection(); cm.CommandText = @"SELECT SubName FROM Subs"; using (reader = cm.ExecuteReader()) { while (reader.Read()) { string Output = Convert.ToString(reader["SubName"]); AutoCompeleteString.Add(Output); } } textBox1.AutoCompleteCustomSource = AutoCompeleteString; }
void Combo() { cbUrun.AutoCompleteSource = AutoCompleteSource.CustomSource; AutoCompleteStringCollection veri = new AutoCompleteStringCollection(); var lst = _db.stStokDurums.Select(x => x.UrunKodu).Distinct(); foreach (string urun in lst) { veri.Add(urun); cbUrun.Items.Add(urun); } cbUrun.AutoCompleteCustomSource = veri; int dgv; dgv = cbUrun.Items.Count; MyArray = new string[dgv]; for (int p = 0; p < dgv; p++) { MyArray[p] = cbUrun.Items[p].ToString(); } }
public void FillTheVendorInfo(custVendor.CustVendorManager.custvendorinfo custInfo) { this.tbVendorNumber.Text = custInfo.cvnumber; this.tbPaymentTerms.Text = custInfo.paymentTerm; this.tbBillTo.Text = custInfo.billTo; if (custInfo.contact1 != null && custInfo.contact1.Trim().Length > 0) { this.tbContact.Text = custInfo.contact1; if (custInfo.contact2 != null && custInfo.contact2.Trim().Length > 0)//两者都有值 { this.tbContact.AutoCompleteMode = AutoCompleteMode.SuggestAppend; this.tbContact.AutoCompleteSource = AutoCompleteSource.CustomSource; AutoCompleteStringCollection autoSource = new AutoCompleteStringCollection(); autoSource.Add(custInfo.contact1); autoSource.Add(custInfo.contact2); tbContact.AutoCompleteCustomSource = autoSource; } } else if (custInfo.contact2 != null && custInfo.contact2.Trim().Length > 0) { this.tbContact.Text = custInfo.contact2; } else { } List <custVendor.CustVendorManager.custvendorinfoshipto> shipToList = custVendor.CustVendorManager.CustVenInfoManager.GetShipTo(custInfo.cvId); List <string> shipToListString = new List <string>(); foreach (custVendor.CustVendorManager.custvendorinfoshipto shipto in shipToList) { shipToListString.Add(shipto.shipTo); } SetShipToList(shipToListString); }
private void autocomnic() { connection conn = new connection(); conn.Connection(); string sqlquery = "SELECT NIC_No FROM membersdetails"; OleDbCommand sqlcomm = new OleDbCommand(sqlquery, conn.con); conn.con.Open(); OleDbDataReader sdr = sqlcomm.ExecuteReader(); AutoCompleteStringCollection autotext1 = new AutoCompleteStringCollection(); while (sdr.Read()) { //autotext.Add(sdr.GetString(0)); autotext1.Add(sdr["NIC_No"].ToString()); } txtsearchnic.AutoCompleteMode = AutoCompleteMode.SuggestAppend; txtsearchnic.AutoCompleteSource = AutoCompleteSource.CustomSource; txtsearchnic.AutoCompleteCustomSource = autotext1; conn.con.Close(); }
private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e) { DataTable tabla = (DataTable)e.UserState; switch (e.ProgressPercentage) { case 0: TB_DescProve.DataSource = tabla; TB_DescProve.DisplayMember = "Nombre"; TB_DescProve.ValueMember = "Proveedor"; AutoCompleteStringCollection stringDescProve = new AutoCompleteStringCollection(); foreach (DataRow row in tabla.Rows) { stringDescProve.Add(Convert.ToString(row["Nombre"])); } TB_DescProve.AutoCompleteCustomSource = stringDescProve; break; case 1: TB_Prove.DataSource = tabla; TB_Prove.DisplayMember = "Proveedor"; TB_Prove.ValueMember = "Proveedor"; AutoCompleteStringCollection stringCodProve = new AutoCompleteStringCollection(); foreach (DataRow row in tabla.Rows) { stringCodProve.Add(Convert.ToString(row["Proveedor"])); } TB_Prove.AutoCompleteCustomSource = stringCodProve; break; case 2: WindowState = FormWindowState.Normal; break; } }
private void AutoCompletar() { var items = this.negocioCuenta.CargarCuenta(); AutoCompleteStringCollection cuentas = new AutoCompleteStringCollection(); foreach (var item in items) { cuentas.Add(item.Cuenta); } txtnumcuent.AutoCompleteCustomSource = cuentas; var itemsc = this.negocioCentro.CargarCentro(); AutoCompleteStringCollection centro = new AutoCompleteStringCollection(); foreach (var item in itemsc) { centro.Add(Convert.ToString(item.Codcentro)); } txt_centro.AutoCompleteCustomSource = centro; }
public Ventas() { InitializeComponent(); DbConnection conn = new DbConnection(true); List <string> lista = new List <string>(); foreach (Producto prod in conn.ObtenerTodosLosProductos()) { if (conn.Existencia(prod.Id) == true) { lista.Add(Convert.ToString(prod.Descripcion)); } } txtNombre.AutoCompleteMode = AutoCompleteMode.SuggestAppend; AutoCompleteStringCollection data = new AutoCompleteStringCollection(); data.AddRange(lista.ToArray()); txtNombre.AutoCompleteCustomSource = data; txtNombre.AutoCompleteSource = AutoCompleteSource.CustomSource; conn.Close(); }
public GeneralProperties(ref SwProperties prop) { propertySet = prop; InitializeComponent(); AutoCompleteStringCollection skdim = new AutoCompleteStringCollection(); for (int i = 0; i < Properties.Settings.Default.SketchDimensions.Count; i++) { skdim.Add(Properties.Settings.Default.SketchDimensions[i]); } tbLength.AutoCompleteSource = AutoCompleteSource.CustomSource; tbLength.AutoCompleteCustomSource = skdim; tbWidth.AutoCompleteSource = AutoCompleteSource.CustomSource; tbWidth.AutoCompleteCustomSource = skdim; tbThick.AutoCompleteSource = AutoCompleteSource.CustomSource; tbThick.AutoCompleteCustomSource = skdim; tbWallThick.AutoCompleteSource = AutoCompleteSource.CustomSource; tbWallThick.AutoCompleteCustomSource = skdim; }
private void billgrid_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e) { try { var txtBox = e.Control as TextBox; if (txtBox != null && txtBox is TextBox) { txtBox.TextChanged -= txtBox_TextChanged; txtBox.TextChanged += txtBox_TextChanged; txtBox.AutoCompleteMode = AutoCompleteMode.Suggest; txtBox.AutoCompleteSource = AutoCompleteSource.CustomSource; AutoCompleteStringCollection dataCollection = new AutoCompleteStringCollection(); LoadProductData(txtBox.Text.Trim(), dataCollection); txtBox.AutoCompleteCustomSource = dataCollection; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
void Combo()//Combo otomatik tamamlama metodu kullanımı.. { cbUrun.AutoCompleteSource = AutoCompleteSource.CustomSource; AutoCompleteStringCollection veri = new AutoCompleteStringCollection(); var lst = _db.bgUrunGiris.Select(x => x.UrunKodu).Distinct(); foreach (string urun in lst) { veri.Add(urun); cbUrun.Items.Add(urun); } cbUrun.AutoCompleteCustomSource = veri; int dgv;//DataGridView kısaltması(dgv) dgv = cbUrun.Items.Count; MyArray = new string[dgv]; for (int p = 0; p < dgv; p++) { MyArray[p] = cbUrun.Items[p].ToString(); } }
private void RoutingForm_Load(object sender, EventArgs e) { // Initialize map: gMapControl.MapProvider = GMap.NET.MapProviders.OpenStreetMapProvider.Instance; GMaps.Instance.Mode = AccessMode.ServerOnly; gMapControl.Manager.Mode = AccessMode.ServerOnly; gMapControl.DragButton = MouseButtons.Left; // Set center of map gMapControl.Position = new PointLatLng(-6.89148, 107.6106591); gMapControl.MinZoom = 2; gMapControl.MaxZoom = 18; gMapControl.Zoom = 15; // set attribute for textbox become autocomplete textBoxFrom.AutoCompleteMode = AutoCompleteMode.Suggest; textBoxFrom.AutoCompleteSource = AutoCompleteSource.CustomSource; AutoCompleteStringCollection autoCompleteNodeFrom = new AutoCompleteStringCollection(); textBoxDestination.AutoCompleteMode = AutoCompleteMode.Suggest; textBoxDestination.AutoCompleteSource = AutoCompleteSource.CustomSource; AutoCompleteStringCollection autoCompleteNodeDestination = new AutoCompleteStringCollection(); // get data from database and put into listFrom listFrom = dbConnection.getWayNodeData(); for (int i = 0; i < listFrom.Count; i++) { autoCompleteNodeFrom.Add(listFrom[i].getWayName()); } textBoxFrom.AutoCompleteCustomSource = autoCompleteNodeFrom; // get data from database and put into listDestination listDestinantion = dbConnection.getWayNodeData(); for (int i = 0; i < listDestinantion.Count; i++) { autoCompleteNodeDestination.Add(listDestinantion[i].getWayName()); } textBoxDestination.AutoCompleteCustomSource = autoCompleteNodeDestination; }
private void Adat_Load(object sender, EventArgs e) { //Bu Kısımda Auto Complete Özelliği Çalışır Interest ınterest = new Interest(); var sonuclar = ınterest.GetDataTable(dataGridView1); DifferentCode = new List <string>(); //Farklı Hesap Kodlarını Alıyorum. for (int j = 0; j < sonuclar.Rows.Count; j++) { if (DifferentCode.Contains(sonuclar.Rows[j]["Hesap Kodu"].ToString())) { } else { DifferentCode.Add(sonuclar.Rows[j]["Hesap Kodu"].ToString()); } } Codes = new AutoCompleteStringCollection(); Codes.AddRange(DifferentCode.ToArray()); textBoxHesapKodu.AutoCompleteCustomSource = Codes; }
private void Form3_Load(object sender, EventArgs e) { try { DAL.DAL.cmd = new MySqlCommand("SELECT pa_name FROM patient", DAL.DAL.con); DAL.DAL.con.Open(); MySqlDataAdapter da = new MySqlDataAdapter(DAL.DAL.cmd); DataTable dt = new DataTable(); da.Fill(dt); AutoCompleteStringCollection MyCollection = new AutoCompleteStringCollection(); for (int i = 0; i < dt.Rows.Count; i++) { MyCollection.Add(dt.Rows[i][0].ToString()); } textBox7.AutoCompleteCustomSource = MyCollection; textBox7.AutoCompleteSource = AutoCompleteSource.CustomSource; textBox7.AutoCompleteMode = AutoCompleteMode.Suggest; DAL.DAL.con.Close(); } catch { return; } }
void Combo() { urncmb.AutoCompleteSource = AutoCompleteSource.CustomSource; AutoCompleteStringCollection veri = new AutoCompleteStringCollection(); var lst = _db.tblProducts.Select(s => s.Name).Distinct(); foreach (string urn in lst) { veri.Add(urn); urncmb.Items.Add(urn); } urncmb.AutoCompleteCustomSource = veri; int dgv; dgv = urncmb.Items.Count; MyArray = new string[dgv]; for (int p = 0; p < dgv; p++) { MyArray[p] = urncmb.Items[p].ToString(); } }