Re: SetFocus convert from 2003 to 2005 problem

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



vs2005 has this feature builtin. use the builtin or change the name of your
routine.

-- bruce (sqlwork.com)

<gnewsham@xxxxxxxxx> wrote in message
news:1163438464.522400.4320@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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



.



Relevant Pages

  • Re: SetFocus convert from 2003 to 2005 problem
    ... bruce barker wrote: ... Private Sub SetFocus ... Warning 2 'Public Overridable Sub RegisterStartupScript(key As String, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: somewhat unusual way to define a sub
    ... R> string on every execution. ... R> in the conventional way of defineing a sub. ... which effectively results in a sub &WARNING to be created. ...
    (comp.lang.perl.misc)
  • Project Error
    ... Private Declare Sub Sleep Lib "Kernel32" ... Dim strDataSrc As String ...
    (microsoft.public.vb.bugs)
  • Re: FTP CD command
    ... My code connects to a ftp site and the enumerates all content on that place ... Public Property UriAs String ... End Sub ... Dim listRequest As FtpWebRequest = CType, ...
    (microsoft.public.dotnet.languages.vb)
  • Re: FTP CD command
    ... Private _Uri As String ... End Sub ... Dim listRequest As FtpWebRequest = CType, ... Public Sub UploadAsynch(ByVal fileName As String, ByVal uploadUrl As ...
    (microsoft.public.dotnet.languages.vb)