If I try to programatically assign a value of 64 to a combobox through the SelectedValue property I get an error (shown below). I can set it to any value I want except 64.
Do you have any insight on this?
Thanks,
- Dan
--error message--
"System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: '-2147483648' is not a valid value for 'index'.
at System.Windows.Forms.ComboBox.set_SelectedIndex(Int32 value)
at System.Windows.Forms.ListControl.set_SelectedValue(Object value)
at UnhandledEx.Form2.Button1_Click(Object sender, EventArgs e) in C:\Projects\Test\Form2.vb:line 257"
--error message--
... code in the page load
ComboBox1.DataSource = dtUsers
ComboBox1.DisplayMember = "Name"
ComboBox1.ValueMember = "EmployeeID"
... code in the page load
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim x As Int64
Try
If IsNumeric(TextBox1.Text) Then
x = CDbl(TextBox1.Text)
End If
If IsDBNull(x) = True Then
ComboBox1.FindString("")
Else
ComboBox1.SelectedValue = x
End If
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End Sub