ورود

نسخه کامل مشاهده نسخه کامل : نمایش یک ستون از بانک اطلاعاتی access در combobox



p30online
26-03-2013, 14:00
دوستان کسی می دونه چه طوری می شود با کد نویسی اطلاعات از ACCESS را در combobox نمایش داد .

p30online
26-03-2013, 17:52
سلام دوستان من خودم اینو نوشتم شاید بدردتون بخوره.

private void combo()
{


comboBox1.Items.Add(dataGridView2.CurrentRow.Cells[1].Value.ToString());
comboBox1.Items.Add(dataGridView2.CurrentRow.Cells[2].Value.ToString());
comboBox1.Items.Add(dataGridView2.CurrentRow.Cells[3].Value.ToString());
comboBox1.Items.Add(dataGridView2.CurrentRow.Cells[4].Value.ToString());
comboBox1.Items.Add(dataGridView2.CurrentRow.Cells[5].Value.ToString());
comboBox1.Items.Add(dataGridView2.CurrentRow.Cells[6].Value.ToString());
comboBox1.Items.Add(dataGridView2.CurrentRow.Cells[7].Value.ToString());
comboBox1.Items.Add(dataGridView2.CurrentRow.Cells[8].Value.ToString());
comboBox1.Items.Add(dataGridView2.CurrentRow.Cells[9].Value.ToString());
comboBox1.Items.Add(dataGridView2.CurrentRow.Cells[10].Value.ToString());

}

بعد داخل لود فرم
این را تایپ کنید .
combo();
:n05:

alisaeedi_v
14-04-2013, 10:07
سلام..بهتر اینه که اون فیلد رو به کامبوباکس بایند کنی...
"cmb1.datasource="tablename;
cmb1.displaymember="fieldname";