Manipulating controls from another form.
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Manipulating controls from another form.

  1. #1
    Join Date
    Feb 2011
    Posts
    1

    Manipulating controls from another form.

    Lets say I have a List Box called listBox1 on Form1 and on Form2 I have a button called Delete. Whenever the user presses the Delete button on Form2 it should delete an entry from listBox1 in Form1. How can I manipulate listBox1 from Form2's Delete button?

  2. #2
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    15,002

    Re: Manipulating controls from another form.

    You can use Form1.xxx to access a PUBLIC control
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Jan 2002
    Posts
    195

    Re: Manipulating controls from another form.

    This depends on what version of VB your using. If you are in fact using VB6 then you can do as stated above For1.Listbox1.item(x).delete

    If you are using .net ie VB 2010 express. then you will need to get the handle of the instance of the form. Which you can save to a global variable when you initialize the form.

  4. #4
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    15,002

    Re: Manipulating controls from another form.

    Not really, if you have a PUBLIC form
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center