Solved

Referencing Forms elements from custom Controls

Posted on 1998-11-16
2
164 Views
Last Modified: 2010-05-03
OK.. I'm new in VB... I need a way to say make a text box display a message (from a database or any source for that matter)by clicking on a command button from within my own control... So how do you access the command button on the form from the custom control... thanx
0
Comment
Question by:lamer2
2 Comments
 
LVL 2

Accepted Solution

by:
peterwest earned 50 total points
ID: 1445163
Hi,

Ok then - you could use the ParentControls property of the ActiveX object but this uses an object index to specify which object you want to access; this is obviously a little fiddly - an easier way is like this:

Private Sub Command1_Click()

      UserControl.Parent.Text1.Text = "Hello World"

End Sub


Just as you can prefix a property with an object you can also prefix an object with a form.  In this case we use the Parent property of the UserControl to get a reference to the parent form and then we can modify the textboxes property.

Hope this helps,

Pete

0
 

Author Comment

by:lamer2
ID: 1445164
when i kinda figure it out myself...

I noticed that typing

parent.text1 = "bla bla does the same thing"
0

Featured Post

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
bit defender blocks good applications 2 94
Passing a Text Box name to a Sub 6 96
MsgBox 4 60
Set email body to html using vbscript 6 41
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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 Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

770 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