如何从另一个私有方法调用CheckedChanged(sender,e)

时间:2018-12-27 10:30:17

标签: vb.net events gridview

我有两个不同的功能:

Public Sub CB_CheckChanged(sender As Object, e As EventArgs)
    line of code;
End Sub

Protected Sub GV_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GV.RowDataBound
    line of code;
End Sub

我正在尝试在CB_CheckChanged()函数内调用GV_RowDataBound()。 您能告诉我如何将一个事件转换为另一个事件吗?

注意:复选框位于gridview内

2 个答案:

答案 0 :(得分:2)

Protected Sub GV_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GV.RowDataBound
    CB_CheckChanged(Nothing, Nothing)
End Sub

答案 1 :(得分:2)

您可以尝试

Public Sub CB_CheckChanged(sender As Object, e As EventArgs)
   line of code;
End Sub

Protected Sub GV_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GV.RowDataBound
  CB_CheckChanged(Nothing, Nothing)
End Sub

如果事件未处理任何任务,则可以使用

 Public Sub CB_CheckChanged()
   line of code;
End Sub

Protected Sub GV_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GV.RowDataBound
  CB_CheckChanged()
End Sub