how to send data value from public class to mdichild active on vb.net
here is the class and i have windowsform called frmAkun
when i set frmAkun to mdichild, i call the class but can't return value to FrmAkun back
but if i set frmAkun as WindowsForm not mdichild the function is worked normaly
Public Class classAkun
Public Sub cariBalance(ByVal textnode As String)
Dim MyCmdA As New OdbcCommand
Dim MyRederA As OdbcDataReader
Dim openD, openC As String
Dim lastD, lastC As String
Dim noAkun As String
Dim classi As String
noAkun = Left(textnode, 6)
MyCmdA.CommandText = "SELECT * FROM daftarakun WHERE NoAkun = '" & noAkun & "'"
MyCmdA = New OdbcCommand(MyCmdA.CommandText, MyCn)
MyRederA = MyCmdA.ExecuteReader
If MyRederA.Read Then
openD = MyRederA.Item("OpBalanceD")
lastD = MyRederA.Item("LastBalanceD")
openC = MyRederA.Item("OpBalanceC")
lastC = MyRederA.Item("LastBalanceC")
classi = MyRederA.Item("Klasifikasi")
If classi = "ASSET" Or classi = "EXPENSE" Then
If openC = 0 Then
frmAkun.OpBalance.Text = openD
end if
end sub
end class
"frmAkun.OpBalance.Text = openD " can't send to frmakun when frmakun is mdichild active
it's sent when frmAkun is not mdichild
thx
Why use a sub when you can use a function? Convert your sub to a function that returns the OpenD as a string (or an empty string if it's not 0) and call it from the form
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.