TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sai Kishore
NA
7
1.4k
I write a piece of code for binding different values into a combobox at run time
Jun 18 2012 9:59 AM
hi friends i write a piece of code for binding different values into a combobox at run time.. the code is running properly for one value, if i want to add some more values at run time to the same combobox then it is replacing the old values with the new values... i dont want to replace the values.. it has to append the values to the same combobox..
please go thru the code.... as follows...
DataSet dsInv =new DataSet();
OleDbDataAdapter dap = new OleDbDataAdapter("select InvestigationName from ServiceInvestigations where BillNo =" + txtBillNo.Text + "", cn);
dap.Fill(dsInv, "ServiceInvestigations");
dgvReports.DataSource = dsInv.Tables["ServiceInvestigations"];
for (int i = 0; i < dgvReports.RowCount - 1; i++)
{
string tesName = dgvReports.Rows[i].Cells["InvestigationName"].Value.ToString();
txtInvestigations.Text = string.Concat(tesName+",",txtInvestigations.Text);
if (cn.State == ConnectionState.Open)
{
cn.Close();
}
cn.Open();
OleDbDataAdapter da = new OleDbDataAdapter("select [Inv_name] from [Investigation] where Lab='"+tesName+"' ", cn);
DataTable dt = new DataTable();
da.Fill(dt);
DataRow dr;
dr = dt.NewRow();
cmbInvNames.DisplayMember = "Inv_name";
cmbInvNames.ValueMember = "Inv_name";
cmbInvNames.DataSource = dt;
cmbInvNames.Items.Add(item);
cmbInvNames.Items.Add(dt);
cn.Close();
}
Reply
Answers (
1
)
what is difference between setup.exe and msi setup in .net?
how to make gridview rows clickable??