form's method problem

A

Agnes

In my system,every form needs to check the right first, if it return false,
the myInvform should not process 'newclick'. How can I do that ?, I write
the following codes, it seems wrong.

---------------------------------
in myBaseform,
Private Sub btnNew_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnNew.Click
If check_right = false Then
MessageBox.Show("U are no right to access !", "Error Message - New Doc",
MessageBoxButtons.OK, MessageBoxIcon.Warning)
exit sub
End If
End Sub

in myInvform , [Which is inherited myBaseForm]
Private Sub btnNew_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnNew.Click
Me.stdSB_screenmode.Text = "NEW"
Me.txtCompanyCode.setfocus
end sub
--------------------------------------------------------------
 
M

Matt S

It looks like you have overridden the Sub btnNew_Click in myInvForm - so
only your new implementation will execute from myInvForm. You could call:
MyBase.btnNew_Click before your new implementation to fix this.

Hope this helps.
 
M

Matt S

Note that if you use MyBase.btnNew_Click, then BOTH the implementations will
execute, so this will be functionally incorrect, but should explain why the
problem was occurring.

Hope this helps.

Matt S said:
It looks like you have overridden the Sub btnNew_Click in myInvForm - so
only your new implementation will execute from myInvForm. You could call:
MyBase.btnNew_Click before your new implementation to fix this.

Hope this helps.

Agnes said:
In my system,every form needs to check the right first, if it return false,
the myInvform should not process 'newclick'. How can I do that ?, I write
the following codes, it seems wrong.

---------------------------------
in myBaseform,
Private Sub btnNew_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnNew.Click
If check_right = false Then
MessageBox.Show("U are no right to access !", "Error Message - New Doc",
MessageBoxButtons.OK, MessageBoxIcon.Warning)
exit sub
End If
End Sub

in myInvform , [Which is inherited myBaseForm]
Private Sub btnNew_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnNew.Click
Me.stdSB_screenmode.Text = "NEW"
Me.txtCompanyCode.setfocus
end sub
 
H

Herfried K. Wagner [MVP]

* "Agnes said:
In my system,every form needs to check the right first, if it return false,
the myInvform should not process 'newclick'. How can I do that ?, I write
the following codes, it seems wrong.

---------------------------------
in myBaseform,
Private Sub btnNew_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnNew.Click
If check_right = false Then
MessageBox.Show("U are no right to access !", "Error Message - New Doc",
MessageBoxButtons.OK, MessageBoxIcon.Warning)
exit sub
End If
End Sub

in myInvform , [Which is inherited myBaseForm]
Private Sub btnNew_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnNew.Click
Me.stdSB_screenmode.Text = "NEW"
Me.txtCompanyCode.setfocus
end sub
--------------------------------------------------------------

\\\
RemoveHandler Me.Button1.Click, AddressOf MyBase.Button1_Click
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top