How to Use OCX & ActiveX in
Visual Basic 6 with Data Binding


wpe14.jpg (2567 bytes)

gball.gif (956 bytes) For Visual Basic 4.0, programmers can set the bindable property of the OCX/ActiveX to bind to a database table field. When the users change the record, the field value will be automatically put into the bindable property of the OCX/ActiveX. For example, you can bind the Text property of the TextBox control with a field of Text type in a table of a database.

gball.gif (956 bytes) In my products, the Animation GIF ActiveX can support data binding. The GIF property is bindable. You can bind the GIF picture with a database table field. Because in database, Text type doesn't support zero character, we should use Memo type to store the GIF picture.

gball.gif (956 bytes) And another problem is in Visual Basic 4/5/6, the data binding using DataControl doesn't support string that contains zero character. They look the zero character as the string end character and cut the characters after the zero character before passing the text to the ActiveX. Sometimes, the problem doesn't occur when using Remote Data Control as the binding control. The behavior is related to the ODBC driver you are using.

gball.gif (956 bytes) After wide testing, I found only the ADO Data Control using OLEDB technology can pass the correct Memo data to the ActiveX in any condition. So if you want to use data binding in my Animation GIF ActiveX. I suggest you to use Visual Basic 6.0 and the ADO Data Control 6.0.

gball.gif (956 bytes) To use data binding is very easy like following steps:

  1. Put a ADO Data Control onto your form and set the database, cursor, SQL/Table values using the ADO Data Control property pages.
  2. Put a ActiveX which has the bindable properties onto your form.
  3. You can see a DataBindings item in the "Properties Window" of the ActiveX. Click the "..." on the right of the item. You can get the dialog box which you can set the data bindings.

gball.gif (956 bytes) I am using Microsoft Visual Basic 6.0, Copyright© 1987, 1998 Microsoft Corporation.

gball.gif (956 bytes) For how to use ActiveX in Visual Basic 6. Please visit How to use ActiveX in Visual Basic 6.

 

Related topics: How to use ActiveX in Microsoft Visual Studio Products How to use ActiveX in Visual FoxPro 3 How to use ActiveX in Visual Basic 4 How to use ActiveX in Visual C++ 4 How to use ActiveX in Visual Basic 5 How to use ActiveX in Visual C++ 5 How to use ActiveX in Visual FoxPro 5  How to use ActiveX in Visual Basic 6 How to use ActiveX in Visual C++ 6 How to use ActiveX in Visual Foxpro 6

Other topics: How to use ActiveX in Products of Inprise Corproation How to use ActiveX in Microsoft Office 97 Products How to use ActiveX in Internet

 

Home Page jinhui@jcomsoft.com

 

Your comments and any suggestion are welcomed.
You can send me E-mail or sign my guest book.