Click here to Skip to main content
15,879,326 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to write text changed event in combo box please help me how to write
Posted

1 solution

 
Share this answer
 
Comments
MANI 14 19-Oct-13 8:18am    
this is not working.... Is any wrong here pls help me
cmbBatchno.Load += new EventHandler(cmbBatchno_Load())

public void cmbBatchno_SelectedIndexChanged(object sender, EventArgs e)
{

if (ViewState["BatchNo"] != null)
{
DataTable dtBatchNoDtls = (DataTable)ViewState["BatchNo"];
for (int i = 0; i < dtBatchNoDtls.Rows.Count; i++)
{
if (dtBatchNoDtls.Rows[i]["BatchNo"].ToString() == cmbBatchno.Text)
{
txtExpdate.Text = dtBatchNoDtls.Rows[i]["ExpDate"].ToString();
txtMRP.Text = dtBatchNoDtls.Rows[i]["MRP"].ToString();
txtRate.Text = dtBatchNoDtls.Rows[i]["Rate"].ToString();
if (txtExpdate.Text != "")
txtPacks.Focus();
else
txtExpdate.Focus();
break;
}
else
{
txtExpdate.Text = string.Empty;
txtMRP.Text = "";
txtRate.Text = "";
}
}
}
}
MANI 14 19-Oct-13 8:19am    
sorry... not that event
void cmbBatchno_Load(object sender, EventArgs e)
{
if (ViewState["BatchNo"] != null)
{
DataTable dtBatchNoDtls = (DataTable)ViewState["BatchNo"];
for (int i = 0; i < dtBatchNoDtls.Rows.Count; i++)
{
if (cmbBatchno.Text == dtBatchNoDtls.Rows[i]["BatchNo"].ToString())
{
txtExpdate.Enabled = false;
txtMRP.Enabled = false;
break;
}
else
{
txtExpdate.Enabled = true;
txtMRP.Enabled = true;
txtExpdate.Text = string.Empty;
txtMRP.Text = "";
txtRate.Text = "";
}
}

}


}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900