By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,479 Members | 988 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,479 IT Pros & Developers. It's quick & easy.

form's method problem

P: n/a
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
--------------------------------------------------------------
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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" <ag***@dynamictech.com.hk> wrote in message
news:uf**************@TK2MSFTNGP11.phx.gbl...
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
--------------------------------------------------------------

Nov 21 '05 #2

P: n/a
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" <ma**@toomuchspamalready.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
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" <ag***@dynamictech.com.hk> wrote in message
news:uf**************@TK2MSFTNGP11.phx.gbl...
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
--------------------------------------------------------------


Nov 21 '05 #3

P: n/a
* "Agnes" <ag***@dynamictech.com.hk> scripsit:
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
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.