Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Passing Controls to a vb form

Posted on 2003-02-20
Medium Priority
Last Modified: 2010-05-01
I am new about vb programming. Please can you tell me how can I send control names froma vb form to another
Question by:naimyildiz
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 11

Accepted Solution

rdrunner earned 200 total points
ID: 7987245
You can even pass the whole control to another form...

You just need to declare a variable to hold the control.

But most of the times this is not needed. You should call functions and pass a control along with the function call.

(by accessing a control "directly" you can cause side effects...

anyway... here are some exampels how to...

Direct access to the control:
form1.text1.Value = "data from from 2"

Passing the control:
(in form2)
Public mycontrol As Control

(in form1)
set form2.mycontrol =  me.text1

Passing a control in a function
Public sub fillList(ListTofill As ListBox, sql As String)
End Function

Call this function:
fillList me.list1, "Select * from bla"


Expert Comment

ID: 8901373
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
LVL 49

Expert Comment

ID: 8963954
Moderator, my recommended disposition is:

    Accept rdrunner's comment(s) as an answer.

DanRollins -- EE database cleanup volunteer

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article ( for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question