Results 1 to 2 of 2

Thread: vb6 and vb.net referencing!!

  1. #1

    Thread Starter
    Lively Member Ksyrium's Avatar
    Join Date
    Jun 2004
    Location
    Tennessee..yes, we CAN code!!
    Posts
    80

    vb6 and vb.net referencing!!

    Back in VB6 you could have two forms in one project and able to access any controls, methods, etc. on one form from the other without any problem...piece of cake!!

    In vb.net or C# it isn't that easy. How do you go about doing this in .NET?? There has to be an easy way!!!

    Am I missing something????

  2. #2
    Lively Member Doddddy's Avatar
    Join Date
    Jul 2004
    Location
    Cluj-Napoca, Romania
    Posts
    109
    you're missing the fact that in vb.net the forms you design are all classes instead of instances of objects...

    if you set the start object to a form class (from the project properties) one instance of that form will be created automaticly...

    if you want to manage yourself the creation of forms, you better start the program in sub main... you should have a sub main preferably in a module like this:


    VB Code:
    1. module mainmodule
    2.  
    3. public sub main
    4.   'here you can create as many forms as you want
    5.   dim a as form1
    6.   dim b as form2
    7.  
    8.   'the actual creation goes here
    9.   a= new form1
    10.   b= new form2
    11.  
    12.   'now it's preferable to have a program loop, so the application doesnt stop
    13.   while <add here a condition for the program to be still running>
    14.     <add here any runtime code>
    15.     'always add this in order for your application to run well
    16.     application.doevents
    17.   end while
    18. end sub
    19.  
    20. end module

    i hope you understand....
    'nothin last forever even cold november rain

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width