Weird Custom Combo Box behaviour ??? Confused. ...

tarunkapoor

Member
Joined
Apr 10, 2005
Messages
17
Programming Experience
3-5
I have the following code for a custom combo box that i have created. It is inherited from System.Windows.Forms.ComboBox

In the first messagebox, i dont get anything from Me.SelectedText, where i get the correct text in the second messageBox. Does anyone know why is this happening.

VB.NET:
Expand Collapse Copy
Protected Overrides Sub OnSelectedIndexChanged(ByVal e As System.EventArgs)

MyBase.OnSelectedIndexChanged(e)

MessageBox.Show("Selected text now is: " & Me.SelectedText)

Dim key As String
For Each key In ht.Keys
		If (ht(key).Equals(Me.SelectedText)) Then
			  _tag = key
		End If
Next
 
MessageBox.Show("Selected text now is: " & Me.SelectedText)
End Sub
 
You misunderstand what SelectedText is I think. I suggest you have a look at the help topic for the members of the ComboBox class and read what each one actually means.
 
I made the suggestion I did to encourage you to use the help system. If you get used to using it you will be able to avoid issues like this in the future. Most inexperienced developers seem reluctant to use the help, but we of all people should be the ones to use it most. How can we expect ordinary users to use our help systems if we don't use the provided help ourselves? Believe me, the sooner you become well acquainted with it the more productive you will be. Happy coding. :)
 
Back
Top