How do I create my own control

  • Thread starter Thread starter Rhonda
  • Start date Start date
R

Rhonda

I would like to create a control of my own.

The control source will be a true/false value (a Yes/No
field), and depending on the value the graphics of my
control should change.

How do I create such a control?

On my toolbox-bar I can select "More Controls" and then I
can select among all kind of specialized controls. I want
to make such a specialized control myself - that's my goal.
 
That's true - but since my last post received an answer
that was very far from what I was looking for - I hoped a
new posting - with a hopefully more clear description
would give me the answer I was looking for.

And my experience is that once a post is answered, the
activity goes down - as it probably will on this thread as
you have now provided an - excuse me - irrelevant posting
that may be taken for an answer.
 
Hi,
What you are describing is an ActiveX control. You need Visual Basic to create one of these
(or Visual c++). You can't do it from Access. It's not a trvial thing to do.
 
No really!
I started up a new ActiveX Control project from VB.
I drew a circle on the designer and then used the Interface wizard
to map the BackColor to the circle. That's it! The control was ready.

I was shocked at how easy it was.
 
Being new to VB - this may be a challenge.... I guess once
I get the VB-environment going it will be a lot like VBA.

What version of VB should I use? I use MSAccess2000.
-----Original Message-----
No really!
I started up a new ActiveX Control project from VB.
I drew a circle on the designer and then used the Interface wizard
to map the BackColor to the circle. That's it! The control was ready.

I was shocked at how easy it was.

--
HTH
Dan Artuso, Access MVP


"John Vinson" <jvinson@STOP_SPAM.WysardOfInfo.com> wrote
in message
 
I have VB 6.0

Just opened it for the first time... How do I start the
Wizard you refer to? And my toolbar has a "shape" icon -
but I can only draw squares - not circles.
-----Original Message-----
Ideally, VB6.
Anything under 5 and I don't think you can create controls.

--
HTH
-------
Dan Artuso, MVP


"Rhonda" <[email protected]> wrote in
message news:[email protected]...
 
Hi Rhonda,
First you have to choose ActiveX Control as the project type.
Did you do that?
If so, you can change the shape drawn by the Shape tool to a circle in the properties window
under the Shape property. You can select from a number of different shapes.

Next, go to the Add-Ins menu and select Add In Manager...
Then highlight "VB6 ActiveX ctl winzard" and then check the Loaded/Unloaded checkbox
under Load Behavior. Click OK

Now the wizard will appear under the Add-Ins menu.
Start it up.

Click through the screens until you get to the "Create Custom Interface Members" srceen.
Click on New
Here I entered CircleColor as the Name and I selected Property as the type.

Click Next
Now you're going to map the property to the back color of the circle.
So, in the left list box select CircleColor and then under Maps To select Shape1 (or whatever you called
the shape) and then select BackColor from the Member combo box.

You can now just click through to the end and read the report it generates.

What I did also (from the UserControl's properties) was to make the back color white with the style transparent.

Give the Project a name and the UserControl as well and then save everything to the directory of your choice.

Now from the File menu select "Make ProjectName.ocx"
This will actually create the binary ocx file.

I usually just put the=m in my system32 directory.

Now, bring up a Command Prompt and type in:

regsvr32 PathToSystem32\NameOfocxFile

in my case it looks like:

regsvr32 c:\winnt\system32\MyControl.ocx

This will register your control.

Now if open up Access and look at all those extra controls you should see yours in there. It will be listed as:
ProjectName.NameOfControl

You can now add it to the form and experiment. Obviously this is a broad topic, but that's it in a nutshell.
 
The simple stuff is well simple!
It's when the complexity of the control increases and you run into the
specific quirks of Access as an OLE Host container that simple quickly
turns into complex.

Try to expose a Font property.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
Back
Top