VB.NET:表单加载时组合框的SelectedValueChanged事件出错

时间:2014-08-26 09:44:12

标签: vb.net form-load

我有一个函数fill_cboarea(用于填充名为cboarea组合框)。此函数将在Form_load调用 。到达此fill_cboarea func 调试器到cboarea_SelectedValueChanged,因为我已经在其中写了一段代码。给出的是错误。

  

运营商'<>'未定义类型“DataRowView”并键入“Integer

1 个答案:

答案 0 :(得分:0)

您需要查看cboarea_SelectedValueChanged

Private Sub cboarea_SelectedValueChanged(ByVal sender As Object, ByVal e As 
                             System.EventArgs) Handles cboarea.SelectedValueChanged

    Dim item As DataRowView = TryCast(Me.cboarea.SelectedItem, DataRowView)    
    If item.IsEdit = False Then'check whether the cboarea is in edit mode (on load)
       'here your some piece of code
    End If
End Sub