Mar 18 2007

ComboBox SelectedText without focus

Category: .NetRory Primrose @ 04:28
I have just come across something that really surprises me about the WinForms ComboBox. If the control is in DropDown style, the SelectedText, SelectionStart and SelectionLength properties are all empty if the control doesn't have focus. This is crazy! I can't read or write the selected value in the edit part of the control as a result of a button click. Surely there is a way around this

Tags:

Comments (2) -

1.
dotNetEMT dotNetEMT says:

C#  cmbBox.GetItemText(cmbBox.SelectedItem)

2.
dotNetEMT dotNetEMT says:

or simply C#  cmbBox.Text

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading