yuyestar

yuyestar

  • NA
  • 1
  • 0

how to trigger dropdown automatically in combo box in windows form

Jul 26 2006 4:49 AM
hi all,
i would like to trigger a selection of drop down in combo box without user selection.
my method seem no able to work. Please advise.

[DllImport("user32.dll", EntryPoint = "SendMessage")]
public static extern int SendMessage(int hWnd, uint Msg, int wParam, int lParam);

private void dlSCustName_KeyPress(object sender, KeyPressEventArgs e)
{

DataTable
objCustInfo = objCust.GetCustNameID(strCompanyName,strCustomerId);
// get the customer records

if (objCustInfo.Rows.Count > 0)
{
objForm.PopulateComboBox(dlSCustName, objCustInfo);
//call to trigger the drop down in combo box
ShowDropDownList();

}

}

private void ShowDropDownList()
{

SendMessage((int)dlSCustName.Handle , 273, 1,0);
SendKeys.Send("{TAB}");

}