Results 1 to 20 of 20

Thread: Using objects on different forms [Resolved]

Threaded View

  1. #1

    Thread Starter
    Fanatic Member LITHIA's Avatar
    Join Date
    Dec 2002
    Location
    UK, England
    Posts
    575

    Using objects on different forms [Resolved]

    hi,
    this question should be really easy, and i dont understand why something so easy is causing me problems...

    I have a form, called frmMain which starts up with the program. Now in a class called Connection.vb it does several things, and at a certain point in the class i want it to update a listbox on frmMain.

    How the hell do i go about adding an item to a listbox on frmMain when im in this class?

    I know about methods where u have to declare the form, like
    Dim formMain as New frmMain

    but the thing is, doing that will make a new instance of the form and not update the listbox on the form that is already open.

    doing
    Dim formMain as frmMain
    won't work either, i get some error.

    How do i do this? I just don't understand... without any declorations, and write frmMain. I get options like ActiveForm and don't understand...

    in VB6 this was so easy, you just simply wrote frmMain.textbox1.text = "bla"

    so why can't you just do something that easy in VB.NET? like
    frmMain.listbox1.items.add("blah")

    Thanks for the help
    Last edited by LITHIA; Jul 29th, 2004 at 08:51 AM.

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