Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access on OCX-Usercontrol

Status
Not open for further replies.

Kostarsus

Programmer
Nov 30, 2000
86
DE
Hello,

I want to write an OCX which reacts on a lot of events. So I thought, that I splitt the code. One Part of the Code is in the Usercontrol (all the events, initialisation of other ActiveX-Classes, etc.) the other part is in a module or class module (all the functions which are running to complete my ocx)
Now I have the problem to get access on the controls of the usercontrol. All this should be created in VB 5.0.
Can anybody help?

CU Kostarsus
 
If you are doing it in VB5, I think you will have to keep compiling the ocx and having a separate instance of VB running with a test project, and your class. When you do this, you will be able to access controls in the ocx by setting properties and methods of the ocx to interact with the controls on it.

IE, have a property called Text and set the Text property of a text box by:

Public Property Let Text(byval sData As String) ' to set the text
Text1.Text = sData
End Property

Public Property Get Text() As String ' to read the text
Text = Text1.Text
End Property

To set the text in the text box control on the ocx:

Dim objControl As New ucUserControlName
objControl.Text = "New Text"

To read the text in the text box control on the ocx:

Dim sText As String
sText = objControl.Text

And continue with all of the properties and methods you want to expose in your control.

(If you were using VB6, you could have 2 projects open at the same time in one project group and then develop your ocx in one and test in the other project without having to recompile. I don't think you can do this in VB5)

Simon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top