|
-
Jul 10th, 2006, 12:57 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] help abt Active X controls
Hi,
I hv read a line.."Create a method of the ClassBookList control"Class Book List is the name of the Active X control which is to be created.I m unable to understand that how to create a method of any control..Methods are created for the classes bt can they be created for control?n if so thn plzz guide me how?
Regards,
-
Jul 10th, 2006, 01:27 AM
#2
Re: help abt Active X controls
VB.NET MVP 2008 - Present
-
Jul 10th, 2006, 01:53 AM
#3
Thread Starter
Hyperactive Member
Re: help abt Active X controls
 Originally Posted by HanneSThEGreaT
Thankx for your reply.But this article didn't help how to add a method of the Active X conrtol in vb 6.Can u please guide?
-
Jul 10th, 2006, 02:59 AM
#4
Re: help abt Active X controls
A method is simply a Public Sub or Function of your control.
Pete
No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.
-
Jul 10th, 2006, 03:06 AM
#5
Thread Starter
Hyperactive Member
Re: help abt Active X controls
 Originally Posted by pnish
A method is simply a Public Sub or Function of your control.
But till now I just created methods of classes using a class builder utility.so how can I build a method of the control?
i tried to write the code in the declaration as:
public ShowAbout()
is it correct??
Thankx for ur help
-
Jul 10th, 2006, 03:17 AM
#6
Re: help abt Active X controls
Yep. But you need to specify whether it's a Sub or a Function.
Public Sub ShowAbout()
Pete
No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.
-
Jul 10th, 2006, 03:47 AM
#7
Thread Starter
Hyperactive Member
Re: help abt Active X controls
 Originally Posted by pnish
Yep. But you need to specify whether it's a Sub or a Function.
Public Sub ShowAbout()
yah It worked.Please tell me that how to add properties of a control using property procedure?
-
Jul 10th, 2006, 08:20 AM
#8
Hyperactive Member
Re: help abt Active X controls
Add the following to the Declerations section of the UserControl: (Decleration section - above all other code)
VB Code:
Private m_varMyProperty As String
Now add the following anywhere in the code:
VB Code:
Public Property Let MyProperty(cValue As String)
m_varMyProperty = cValue
End Property
Public Property Get MyProperty() As String
MyProperty = m_varMyProperty
End Property
So in the project using the usercontrol, you can do the following:
VB Code:
MyControl.MyProperty = "Test"
'OR
Dim cTest As String
cTest = MyControl.MyProperty
-
Jul 13th, 2006, 02:22 AM
#9
Thread Starter
Hyperactive Member
Re: help abt Active X controls
 Originally Posted by BillGeek
Add the following to the Declerations section of the UserControl: (Decleration section - above all other code)
VB Code:
Private m_varMyProperty As String
Now add the following anywhere in the code:
VB Code:
Public Property Let MyProperty(cValue As String)
m_varMyProperty = cValue
End Property
Public Property Get MyProperty() As String
MyProperty = m_varMyProperty
End Property
So in the project using the usercontrol, you can do the following:
VB Code:
MyControl.MyProperty = "Test"
'OR
Dim cTest As String
cTest = MyControl.MyProperty
thankx for the help.It worked.Is there any wizard available to build properties of Controls as using Class library componenet we can build properties for the classes?
-
Jul 13th, 2006, 02:26 AM
#10
Hyperactive Member
Re: help abt Active X controls
Yip. Go to Add-Ins, make sure that the "Control Interface Wizard" is enabled. This is the "class-builder" for ActiveX controls.
-
Jul 13th, 2006, 01:34 PM
#11
Thread Starter
Hyperactive Member
Re: help abt Active X controls
 Originally Posted by BillGeek
Yip. Go to Add-Ins, make sure that the "Control Interface Wizard" is enabled. This is the "class-builder" for ActiveX controls.
yah ok i got it..Thankx for your reply
-
Jul 14th, 2006, 03:29 AM
#12
Thread Starter
Hyperactive Member
Re: help abt Active X controls
Can you please tell me how to make the objects of Active X Control?n how its properties can be accessed?
Ragards,
-
Jul 14th, 2006, 03:44 AM
#13
Hyperactive Member
Re: help abt Active X controls
What do you mean by "Objects"? If you mean, for example, exposing the properties of a button, you can add properties as shown in post #8 and apply them to your button. Example:
VB Code:
Private m_varButtonCaption As String
Public Property Let ButtonCaption(cValue As String)
m_varButtonCaption = cValue
CommandButton1.Caption = m_varButtonCaption
End Property
Public Property Get ButtonCaption() As String
ButtonCaption = m_varButtonCaption
End Property
If this is not what you want, just shout. 
PS: This is the only way known that you can actually change the properties of controls on a user control.
-
Jul 14th, 2006, 04:04 AM
#14
Thread Starter
Hyperactive Member
Re: help abt Active X controls
 Originally Posted by BillGeek
What do you mean by "Objects"? If you mean, for example, exposing the properties of a button, you can add properties as shown in post #8 and apply them to your button. Example:
VB Code:
Private m_varButtonCaption As String
Public Property Let ButtonCaption(cValue As String)
m_varButtonCaption = cValue
CommandButton1.Caption = m_varButtonCaption
End Property
Public Property Get ButtonCaption() As String
ButtonCaption = m_varButtonCaption
End Property
If this is not what you want, just shout.
PS: This is the only way known that you can actually change the properties of controls on a user control.
By objects I mean as for example objects are created for classes to access thier member functions and data members.Then how to create the objects of a control in order to access its properties?
-
Jul 14th, 2006, 04:11 AM
#15
Hyperactive Member
Re: help abt Active X controls
Well, you just define them as Public. Example, Member Functions:
VB Code:
Public Function myFunc() As Variant
End Function
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|