Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Sun, 6 Apr 2008 16:16:24 -0400,    group: microsoft.public.dotnet.languages.vb.upgrade        back       


Passing Form by Reference-How to Upgrade   
I have a large number of VB6 apps that I would like to convert to VB.net. 
All of them use a standard (here anyway) technique of calling a public sub 
and passing the form reference byref so many frequently used subs/functions 
can be used without regard to the calling form's name.

private sub Form_Load()
call registerForm(Form1)
end sub

In a common module...

public myForm as form

public sub registerForm(byRef theForm as Form)
set myForm = theForm
end sub

public sub otherSubs()
myForm.caption = "some title" & app.version...
myForm.lstRoles.clear
end sub

I've run a couple of these programs through VB.net 2008 and it warns me of 
an error that my controls cannot be referenced because they are in the 
generic namespace Form.

I'd like to know how a similar technique is written in .Net?  Any direction 
greatly appreciated.

Steve
date: Sun, 6 Apr 2008 16:16:24 -0400   author:   Steve Ricketts

Reposting in languages.vb   
"Steve Ricketts"  wrote in message 
news:uNZGN8BmIHA.3940@TK2MSFTNGP05.phx.gbl...
>I have a large number of VB6 apps that I would like to convert to VB.net. 
>All of them use a standard (here anyway) technique of calling a public sub 
>and passing the form reference byref so many frequently used subs/functions 
>can be used without regard to the calling form's name.
>
> private sub Form_Load()
> call registerForm(Form1)
> end sub
>
> In a common module...
>
> public myForm as form
>
> public sub registerForm(byRef theForm as Form)
> set myForm = theForm
> end sub
>
> public sub otherSubs()
> myForm.caption = "some title" & app.version...
> myForm.lstRoles.clear
> end sub
>
> I've run a couple of these programs through VB.net 2008 and it warns me of 
> an error that my controls cannot be referenced because they are in the 
> generic namespace Form.
>
> I'd like to know how a similar technique is written in .Net?  Any 
> direction greatly appreciated.
>
> Steve
>
date: Sun, 6 Apr 2008 16:19:17 -0400   author:   Steve Ricketts

Re: Passing Form by Reference-How to Upgrade   
"Steve Ricketts" 's wild thoughts
were released on Sun, 6 Apr 2008 16:16:24 -0400 bearing the
following fruit:

>I have a large number of VB6 apps that I would like to convert to VB.net. 
>All of them use a standard (here anyway) technique of calling a public sub 
>and passing the form reference byref so many frequently used subs/functions 
>can be used without regard to the calling form's name.
>

You need to post the real code that is causing the error.

You also need to post the exact error message.
--
Jan Hyde

https://mvp.support.microsoft.com/profile/Jan.Hyde
date: Thu, 08 May 2008 12:58:02 +0100   author:   Jan Hyde (VB MVP)

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us