vb.net 如何从VB.net中的另一个子(仍然相同的形式)调用子
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16351941/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how to call sub from another sub(Still Same form) in VB.net
提问by Vinra Gunanta Pandia
i have piece of code below :
我有下面的一段代码:
Public Sub dgvPenjualan_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles dgvPenjualan.CurrentCellChanged
Dim jumlahrow As Integer = dgvPenjualan.RowCount()
'Dim nama As String
Dim jumlahtotal As Integer = 0
Dim harga, jumlah As String
Dim total As Integer
'Dim indeks As Integer and bla bla bla bla bla bla bla
and dgvPenjualan_CurrentCellChangedsub from another sub ?
anybody can help me ? please
和dgvPenjualan_CurrentCellChanged子从另一个子?有人可以帮助我吗?请
回答by ajakblackgoat
If your code inside dgvPenjualan_CurrentCellChangeddoes not use the parameters senderand/or e, then you can call it from anywhere in your project using:
如果您的内部代码dgvPenjualan_CurrentCellChanged不使用参数sender和/或e,那么您可以使用以下方法从项目中的任何位置调用它:
dgvPenjualan_CurrentCellChanged(Nothing, Nothing)
Otherwise, you will need to pass the parameters as well:
否则,您还需要传递参数:
dgvPenjualan_CurrentCellChanged(dgvPenjualan, New System.EventArgs())

