P
Peter
I am having a hard time figuring out exactly why this code is throwing a
System.NullReferenceException when I try to access the SelectedValue
property of the ComboBox. It happens on the line marked with a star (*). It
says "object reference not set to an instance of an object," but I do have
the DisplayMember and ValueMember properties set to a valid property
(actually the same one, which is working on the DisplayMember side of
things). Am I missing something here?
Private Sub PaperColorComboBox_SelectedValueChanged_
(ByVal sender As Object, ByVal e As System.EventArgs)_
Handles PaperColorComboBox.SelectedValueChanged
Dim Selector As ComboBox
Selector = CType(sender, ComboBox)
Try
*MsgBox("SelectedValue Type: " &
Selector.SelectedValue.GetType.ToString)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
Dim xColor As New HexColorConverter()
xColor.HexColor = "E41244"
SwatchBox.BackColor = xColor.Color
End Sub
System.NullReferenceException when I try to access the SelectedValue
property of the ComboBox. It happens on the line marked with a star (*). It
says "object reference not set to an instance of an object," but I do have
the DisplayMember and ValueMember properties set to a valid property
(actually the same one, which is working on the DisplayMember side of
things). Am I missing something here?
Private Sub PaperColorComboBox_SelectedValueChanged_
(ByVal sender As Object, ByVal e As System.EventArgs)_
Handles PaperColorComboBox.SelectedValueChanged
Dim Selector As ComboBox
Selector = CType(sender, ComboBox)
Try
*MsgBox("SelectedValue Type: " &
Selector.SelectedValue.GetType.ToString)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
Dim xColor As New HexColorConverter()
xColor.HexColor = "E41244"
SwatchBox.BackColor = xColor.Color
End Sub