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

SetFocus convert from 2003 to 2005 problem

P: n/a
I am converting an application from vb.net 2003 to 2005
I have the following function which I call when an input error is
detected:

Private Sub SetFocus(ByVal ctrl As System.Web.UI.Control)
Dim s As String = "<SCRIPT
language='javascript'>document.getElementById('" & ctrl.ID &
"').focus() </SCRIPT>"
RegisterStartupScript("focus", s)
End Sub
This is how it is called:
Me.SetFocus(controlName)

I am getting the following warnings and am unsure how to correct them:
Warning 1 sub 'SetFocus' shadows an overloadable member declared in the
base class 'Page'. If you want to overload the base method, this
method must be declared 'Overloads'.

Warning 2 'Public Overridable Sub RegisterStartupScript(key As String,
script As String)' is obsolete: 'The recommended alternative is
ClientScript.RegisterStartupScript(Type type, string key, string
script). http://go.microsoft.com/fwlink/?linkid=14202'

With warning 2 I tried the suggested alternative but then it complains
about incorrect number of arguments??

Help! - Thanks

Nov 13 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
vs2005 has this feature builtin. use the builtin or change the name of your
routine.

-- bruce (sqlwork.com)

<gn******@gmail.comwrote in message
news:11********************@h54g2000cwb.googlegrou ps.com...
>I am converting an application from vb.net 2003 to 2005
I have the following function which I call when an input error is
detected:

Private Sub SetFocus(ByVal ctrl As System.Web.UI.Control)
Dim s As String = "<SCRIPT
language='javascript'>document.getElementById('" & ctrl.ID &
"').focus() </SCRIPT>"
RegisterStartupScript("focus", s)
End Sub
This is how it is called:
Me.SetFocus(controlName)

I am getting the following warnings and am unsure how to correct them:
Warning 1 sub 'SetFocus' shadows an overloadable member declared in the
base class 'Page'. If you want to overload the base method, this
method must be declared 'Overloads'.

Warning 2 'Public Overridable Sub RegisterStartupScript(key As String,
script As String)' is obsolete: 'The recommended alternative is
ClientScript.RegisterStartupScript(Type type, string key, string
script). http://go.microsoft.com/fwlink/?linkid=14202'

With warning 2 I tried the suggested alternative but then it complains
about incorrect number of arguments??

Help! - Thanks

Nov 13 '06 #2

P: n/a
Thanks for taking the time to respond, I changed the name of the
function as suggested and that did the trick.
bruce barker (sqlwork.com) wrote:
vs2005 has this feature builtin. use the builtin or change the name of your
routine.

-- bruce (sqlwork.com)

<gn******@gmail.comwrote in message
news:11********************@h54g2000cwb.googlegrou ps.com...
I am converting an application from vb.net 2003 to 2005
I have the following function which I call when an input error is
detected:

Private Sub SetFocus(ByVal ctrl As System.Web.UI.Control)
Dim s As String = "<SCRIPT
language='javascript'>document.getElementById('" & ctrl.ID &
"').focus() </SCRIPT>"
RegisterStartupScript("focus", s)
End Sub
This is how it is called:
Me.SetFocus(controlName)

I am getting the following warnings and am unsure how to correct them:
Warning 1 sub 'SetFocus' shadows an overloadable member declared in the
base class 'Page'. If you want to overload the base method, this
method must be declared 'Overloads'.

Warning 2 'Public Overridable Sub RegisterStartupScript(key As String,
script As String)' is obsolete: 'The recommended alternative is
ClientScript.RegisterStartupScript(Type type, string key, string
script). http://go.microsoft.com/fwlink/?linkid=14202'

With warning 2 I tried the suggested alternative but then it complains
about incorrect number of arguments??

Help! - Thanks
Nov 13 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.