Accessing all objects on a form - Community Credit Forums
in

    Community Credit Forums

Accessing all objects on a form

Last post Wed, May 23 2007 9:01 PM by LouVega. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • Wed, Apr 25 2007 10:56 AM

    Accessing all objects on a form

    What is the syntax to access all object on a form.

    I am looking for something like: "for all obj as Object on form1"

    Can somebodyhelp?

    Filed under:
  • Wed, May 23 2007 7:12 AM In reply to

    Re: Accessing all objects on a form

    Hi,

    You can able to access all objects on a form,but it should be have public or friend property

    For example.,two forms have application named as form1 and form2,

    form1

    public strCustomerID as string ="C10000"

    form2

    me.lblCustomerID.text=form1.strCustomerID

     

     

     

     

     

  • Wed, May 23 2007 9:01 PM In reply to

    • LouVega
    • Top 10 Contributor
    • Joined on Thu, Sep 14 2006
    • South Carolina, United States
    • Posts 818
    • Moderator
      MVP

    Re: Accessing all objects on a form

    I think you're looking for something like this:

    For Each c As Control In Me.Controls

    'Insert your code here - my example dumps to RTbox)

    RichTextBox1.AppendText(c.Name.ToString & vbCrLf)

    Next

    In VB.NET you're going to use the ME instead of FormName because it can't reference itself in it's default instance.

     

Page 1 of 1 (3 items)
Powered by Community Server (Commercial Edition), by Telligent Systems