• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 200
  • Last Modified:

Databinding my new activex control.

I don't think I understand the process of making my activex control I am creating a databound control.

Does anyone have a SIMPLE example (source code) of any activex control that is databound.
0
gwiz
Asked:
gwiz
  • 3
  • 2
1 Solution
 
JagarCommented:
 Open up your ActiveX control project like normal.  Then click the Tools menu.  Then click Procedure Attributes.  In the top drop box called name, select the property that you want databound, i.e. Text property of a Textbox.
  Then click the Advanced button.  Then check the checkbox labeled Property is data bound.  Then you can check of This property binds to DataField and possible Update immediate.
0
 
gwizAuthor Commented:
I tried that and it didn't work. Here is my code... txtDataValue is a textbox...

--------------------

Public Property Get DataValue() As Variant
    '
    ' Return the data bound value if one exists
    '
    DataValue = txtDataValue
End Property
Public Property Let DataValue(ByVal NewValue As Variant)
    '
    txtDataValue = DataValue
    PropertyChanged "DataValue"
End Property

--------------------

I run the test form that has my ActiveX control on it. I also have a DAO data control on the form. If I use the data control to move through the data, the textbox updates to display the data that is in database as it should. But if I make a change to the text box, the change never gets back to the database.

Did I miss something some place?
0
 
gwizAuthor Commented:
Ok, I think I found something... Can anyone help....


If I take all code out of the UserControl_Initialize then the data binding works. I can read and write to the bound data field. But if I do anything in the _Initialize routine (such as UserControl.Height = 150) then I can read from the data bound field, but I can't write back to it.

What is this all about?

I am running VB6.0 SP3...
0
 
JagarCommented:
Comment never heard of that limitation, but my answer was basically correct.
0
 
gwizAuthor Commented:
Yes it is mostly correct. Post another answer and I will accept it.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now