I have a solution with multiple-project, and i have a master form called master_ChartofAccount
, and on coa_Create
after saving the data, i want to call a Sub
named showCoa
to refresh a grid on coa_Create
, here's my code :
Private Sub cmdAdd_Click(sender As Object, e As EventArgs) Handles cmdAdd.Click
Dim frm As New coa_Create
frm.ShowDialog(Me)
End Sub
and here's cmdSave
code on coa_Create
:
Private Sub cmdSave_Click(sender As Object, e As EventArgs) Handles cmdSave.Click
If Not allowSave() Then Exit Sub
Dim str As String
txtKode.Tag = IIf(IsNothing(txtKode.Tag), "", txtKode.Tag)
If txtKode.Tag.ToString = "" Then
str = "insert into t_chart_of_account (coa_code, coa_name, p_code, is_parent, db_cr, bs_is) " _
& "values ('" & objComp.clearSingleQuote(txtKode.Text) & "', '" & objComp.clearSingleQuote(txtNama.Text) & "', " _
& "'" & objComp.clearSingleQuote(txtParentCode.Text) & "', " & IIf(chkParent.Checked = True, 1, 0) & ", " _
& "'" & IIf(optDb.Checked = True, "DR", "CR") & "', '" & IIf(optBS.Checked = True, "BS", "IS") & "')"
Else
str = "update t_chart_of_account set coa_code = '" & txtKode.Text & "', " _
& "coa_name = '" & objComp.clearSingleQuote(txtNama.Text) & "', p_code = '" & txtParentCode.Text & "', " _
& "is_parent = " & IIf(chkParent.Checked = True, 1, 0) & ", db_cr = '" & IIf(optDb.Checked = True, "DR", "CR") & "', " _
& "bs_is = '" & IIf(optBS.Checked = True, "BS", "IS") & "' WHERE id = " & txtKode.Tag.ToString
End If
objComp.setExecute(str, False)
master_ChartofAccount.showCoa() 'error on this line : Reference to a non-shared member requires an object reference
objComp.msgShow(Me, "Data berhasil di simpan.", "Simpan Berhasil", MessageBoxButtons.OK, MessageBoxIcon.Information)
cmdClose_Click(sender, e)
End Sub
why there's an error msg :
Reference to a non-shared member requires an object reference
on master_ChartofAccount.showCoa()
how to fix this ?
is there other way to call a Sub
from another Form
?
i tried :
Dim frm as new master_ChartofAccount
frm.showCoa()
but the grid on master_ChartofAccount
won't refresh.
Thanks