Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Textfield inside ActiveX Control

Posted on 2002-05-09
4
Medium Priority
?
157 Views
Last Modified: 2010-05-02
I've created an ActiveX Control with a TextBox control inside by VB 6, and will be accessed by other Program Language, say, VC++ or Delphi. What're the procedures in the VB that I need to do so as to achieve the following:

1. a function available to enable the input of the TextBox
2. a function available to disable the input of the TextBox
3. Open up the events on the TextBox, say, OnChange() and so on.

I just know that I can go to "Tool" => "Add Procedure", but not sure is the key. And don't know the steps and the coding to be added.

Thanks!
0
Comment
Question by:mscproj
  • 2
4 Comments
 

Author Comment

by:mscproj
ID: 6998230
I got the answer by myself for the first two questions by using Subroutine inside "Add Procedure". But, no ideas on open up the events!
0
 
LVL 43

Accepted Solution

by:
TimCottee earned 300 total points
ID: 6998394
What you need to do is declare events of your control in the declarations section:

Public Event OnChange()

Then in the Textbox's change event:

Private Sub Textbox1_Change()
  RaiseEvent OnChange
End Sub

For each event that you want to be able to raise in the container. This will then appear in the VB IDE in your container form in the usual drop downs and you can use:

Private Sub MyControl1_OnChange()
 
End Sub

In the code for that container.
0
 

Author Comment

by:mscproj
ID: 6998405
I saw something UserControl Interface Wizard, can it do the samething?
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 6998424
Use the Wizard. I suggest that you start a new project (or at least a new control into a current project) because this wizard generates a lot of lines.

It will allow you to select current properties and methods and events for controls you put into your ActiveX control and it will write all the code for your.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

972 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