[02/03] An unhandled exception of type ...
Code:
An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll
Additional information: Index and length must refer to a location within the string.
I keep getting this error and I don't know why.
It happens each time I click one of the lower items of one of my Comboboxes.
The combobox items are added via a script that runs on Form1_Load which adds the nodes of an xml file into the combobox.
The script for my combobox is as follows:
VB Code:
Private Sub OreDrop_SelectionChangeCommitted(ByVal sender As Object, ByVal e As System.EventArgs) Handles OreDrop.SelectionChangeCommitted
OreInfo.Text = OreDrop.SelectedText.ToString
End Sub
1 Attachment(s)
Re: [02/03] An unhandled exception of type ...
You misunderstand what the SelectedText property is for. It is to be used when the DropDownStyle is DropDown and the user has selected only part of the text displayed in the control, like in a TextBox. In the screenshot below the SelectedText would be "llo W". You should be using code like this:
VB Code:
OreInfo.Text = OreDrop.GetItemText(OreDrop.SelectedItem)
Re: [02/03] An unhandled exception of type ...
Thank you! It works now.
Greatly appreciate your help. :D