This question is locked. New answers and comments are not allowed.
I have a form with a combobox which has some values entered during design-time. I also have a datagridview. I'm trying to convert this so I am using RadControls combobox and gridview.
Here is my working code using built in controls:
Private Sub CustomerBindingSource_CurrentChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CustomerBindingSource.CurrentChanged
Me.customerID = CType(Me.CustomerBindingSource.Current, DataRowView).Row.Item("CustomerID")
filldgvCustomerVariousData(Me.customerID, Me.ComboBox1.SelectedItem)
End Sub
Here is my attempted code using RadControls:
Dim item As RadComboBoxItem = TryCast(rcbo_ShowTransactions.SelectedItem, RadComboBoxItem)
Me.customerID = CType(Me.CustomerBindingSource.Current, DataRowView).Row.Item("CustomerID")
filldgvCustomerVariousData(Me.customerID, item.Text)
The above code will work, but only after I get errors saying that the value of selecteditem is Null and if I Step Over and then go select a value in the RadComboBox.
This is probably true because the form has not yet completely loaded so I have not yet selected an item. But I do have some default text in the RadComboBox. So, maybe SelectedItem isn't the right thing to be using. Is there something else I can try?
Thanks!
Here is my working code using built in controls:
Private Sub CustomerBindingSource_CurrentChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CustomerBindingSource.CurrentChanged
Me.customerID = CType(Me.CustomerBindingSource.Current, DataRowView).Row.Item("CustomerID")
filldgvCustomerVariousData(Me.customerID, Me.ComboBox1.SelectedItem)
End Sub
Here is my attempted code using RadControls:
Dim item As RadComboBoxItem = TryCast(rcbo_ShowTransactions.SelectedItem, RadComboBoxItem)
Me.customerID = CType(Me.CustomerBindingSource.Current, DataRowView).Row.Item("CustomerID")
filldgvCustomerVariousData(Me.customerID, item.Text)
The above code will work, but only after I get errors saying that the value of selecteditem is Null and if I Step Over and then go select a value in the RadComboBox.
This is probably true because the form has not yet completely loaded so I have not yet selected an item. But I do have some default text in the RadComboBox. So, maybe SelectedItem isn't the right thing to be using. Is there something else I can try?
Thanks!