Hey All,
I've got a winforms project that I converted from 1.1 to 2.0
w/the vs
2005 wizard. One of my forms has 2 combo boxes, both bound
to different
DataTables in a strongly typed dataset. When the first
combo (cmbStudy)
changes values, I need to change the filter on the DataTable
to which
the second combo (cmbStatuses) is bound.
The below code worked fine in 1.1, but I'm now getting an
Invalid Cast
exception when I try to convert the contents of
cmbStudy.SelectedItem
into a DataRowView.
Private Sub cmbStudy_SelectedIndexChanged(ByVal sender _
As System.Object _
, ByVal e As System.EventArgs) _
Handles cmbStudy.SelectedIndexChanged
Dim strFilter As String = "Study = 1"
If Not cmbStudy.SelectedItem Is Nothing Then
Dim drv As DataRowView
Dim s As MENU.StudiesRow
drv = CType(Me.cmbStudy.SelectedItem, DataRowView)
s = CType(drv.Row, MENU.StudiesRow)
strFilter = "Study = " &
s.Study.ToString
End If
MENUTrackerApp.MENU1.Statuses.DefaultView.RowFilter =
strFilter
BindStatusCombo()
End Sub
Interestingly, the thing occupying that SelectedItem
property at runtime
is something called a
System.Data.DataViewManagerListItemTypeDescriptor,
which doesn't seem to exist in the vs 2005 documentation, or
in the
object browser. If I type in 'dim x as
System.Data.DataViewManagerListItemTypeDescriptor' I
immediately get a
'Type System.Data.DataViewManagerListItemTypeDescriptor is
not defined'
error.
Can anybody hip me to the new method for getting a reference
to the
DataRow representing the currently selected value in a bound
combobox?
Thanks!
-Roy
|