简体   繁体   中英

VB.NET :Error on combobox's SelectedValueChanged event on form's load

I've a function fill_cboarea (to fill a combobox called cboarea ).This function will call on Form_load .While reaching this fill_cboarea func debugger goes to cboarea_SelectedValueChanged because i have written some piece of code in it.Below given is the error.

Operator '<>' is not defined for type 'DataRowView' and type 'Integer

you need a checking in cboarea_SelectedValueChanged
ie

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM