Combbox not focusing in winforms
mycontrol structure in UI Design
Code Laundry Rate Qty
txt combo txt txt
laundarycmb have selected indexchange property the code is mentioned below :
DataTable dt = new DataTable();
try
{
//int LAUNDARY = 0;
//LAUNDARY = Convert.ToInt32(cmbLaundary.SelectedValue.ToString());
dt = Classes.mhdaktar.Select_With_singleQry("@Laundry_Name", "Select_LaundryItemsbyId", cmbLaundary.Text);
txtRate.Text = dt.Rows[0]["Rate"].ToString();
txtCount.Focus();
}
catch (Exception ex) { }
after the function the finally it focused to Qty i.e counttextbox
and txtQty have below function :
private void txtnoofPer_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
try
{
if (txtCount.Text != "0")
{
if (GridRowEdit == true)
{
LoadEditGrid();
}
else
{
InsertToGrid(dgvInLaundary, "Laundary", "LaudaryId", "Rate", "Count", "GrossAmt0", TxtGrandTotal);
cmbLaundary.Select();
}
}
}
catch (Exception ex) { MessageBox.Show(ex.ToString()); }
}
}