Global Object 
Author Message
 Global Object

How do i make an object accessable globally? for example a label
control, I try changing the code thats creeated by the designer...but
when i do and i go back to design view the label disappears any ideas?

Thanks!



Wed, 31 Aug 2005 03:11:22 GMT  
 Global Object
You shouldn't change the designer code unless it skrews up. Make a global
reference to the label - but you should be using global vars as little as
possible - none is best.

Module Globals
    Global MyLabel as Label
End Module

Public Class Form1

    ... designer code ...

    Private Sub Form_Load(sender as object, e as eventArgs )

        '// Set the reference to your label in form load
        MyLabel = Form1.Label1

    End Sub

End Class

HTH,
Jeremy


Quote:
> How do i make an object accessable globally? for example a label
> control, I try changing the code thats creeated by the designer...but
> when i do and i go back to design view the label disappears any ideas?

> Thanks!



Wed, 31 Aug 2005 03:32:11 GMT  
 Global Object
You can make the object public.  If you fear changing the designer code, the
property grid for the object should have a "Modifiers" property that you can
change.


Quote:
> How do i make an object accessable globally? for example a label
> control, I try changing the code thats creeated by the designer...but
> when i do and i go back to design view the label disappears any ideas?

> Thanks!



Wed, 31 Aug 2005 04:35:57 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Global Variables / Global Objects

2. Access Forms collection, App object or Global object of the Parent application

3. global object

4. Using Global objects

5. Global objects in ActiveX code components -- Important ???'s

6. Reloading global object in DLL after data update

7. Does VB Hold An Extra Reference To A Global Object

8. Using Global Objects

9. Accessing printer global object via COM

10. Local or Global objects

11. ActiveX server with Global Object

12. ActiveX server with Global Object

 

 
Powered by phpBB® Forum Software