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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to retrieve values from Active X Control

Status
Not open for further replies.

ByNary010101

Programmer
Joined
Nov 22, 2004
Messages
16
Location
US
I have created a very simple Active X Control for use in ASP pages using VB 6 just to do some playing around. It consists of nothing more than a ListView control. Now, if I were to actually use this in a production environment how would I be able to grab the values out of the Control for insertion into a Database?? Thanks.
 
It's not too difficult. You have to know how to set up properties for a Usercontrol object. All you need to do is set up a property for the control and map it to the property you want to expose. (If you need to set up properties that can be set in the design time environment, you also have to use the propertybag object, but it doesn't look like you need to do that.)

For an example, let's say you want to be able to use the list box's text property. You'd only need a read only property. Basic requirements are:

1. Using a property Get procedure, create a read only property in your control, say lstboxText.
2. Have the procedure return the listbox's Text property.

Here's the code in your user control:

Public Property Get ListValue() As String
ListValue = lstTest.Text
End Property

Here's the code in your test project:

Private Sub Command1_Click()
MsgBox ListTest1.ListValue
End Sub

HTH

Bob

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top