|
-
Jul 31st, 2000, 07:00 AM
#1
Thread Starter
New Member
Hi. I'm creating trying to create an Active-X control for one of my projects. The purpose of the control is to place a combobox on the form, and allow the user to select from a list of states within Australia. However, it is not really working properly. While the values in the combobox show up just fine and can be selected, I can't seem to grab the selected value out of the control itself. Can someone please help? TIA. The coding is shown below.
Option Explicit
Public Event Click()
Public Event Change()
Private Sub cboState_Change()
RaiseEvent Change
End Sub
Private Sub cboState_Click()
RaiseEvent Click
End Sub
Private Sub UserControl_Initialize()
With cboState
.AddItem ("N/A") 'Not Applicable
.AddItem ("NSW") 'New South Wales
.AddItem ("NT") 'Northern Territory
.AddItem ("QLD") 'Queensland
.AddItem ("SA") 'Southern Australia
.AddItem ("TAS") 'Tasmania
.AddItem ("VIC") 'Victoria
.AddItem ("WA") 'Western Australia
End With
End Sub
Public Property Get Text() As String
Text = cboState.Text
End Property
Public Property Let Text(ByVal New_Text As String)
PropertyChanged "Text"
End Property
-
Jul 31st, 2000, 08:41 AM
#2
Addicted Member
Getting Activex Combo Text
Hi,
I think your problem is in the Text property set up.
Try this:
1- Start your VB Activex project.
2-Go to Add-Ins menu and click Activex Control Interface Wizard.
3- Click Next in the Introduction screen.
4- Select Text in the left square and click > to move it to the right square. Click Next to go ahead.
5- Click Next again to skip the Create Custom Interface Members
6- In the Setting Map screen, select Text in the left square. In the 2 right rectangles (Maps to) select Control = Combo1 and Member = Text. Click Next to go ahead.
7- In the Setting Attributes screen, click next again to go ahead.
8- Then Finish.
Now you can try to access the UserControl.Text property and get the current Combo text.
I hope this can help you...
Michel Jr.
-
Jul 31st, 2000, 10:00 AM
#3
Thread Starter
New Member
-
Jul 31st, 2000, 10:13 AM
#4
Thread Starter
New Member
Oops...
Err...hang on. Nope, something is still wrong. I can get the text property now, but I still can't set it. They're telling me that its read only now.
Option Explicit
Private Sub UserControl_Initialize()
With cboState
.AddItem ("N/A") 'Not Applicable
.AddItem ("NSW") 'New South Wales
.AddItem ("NT") 'Northern Territory
.AddItem ("QLD") 'Queensland
.AddItem ("SA") 'Southern Australia
.AddItem ("TAS") 'Tasmania
.AddItem ("VIC") 'Victoria
.AddItem ("WA") 'Western Australia
End With
End Sub
'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=cboState,cboState,-1,Text
Public Property Get Text() As String
Text = cboState.Text
End Property
Public Property Let Text(ByVal New_Text As String)
cboState.Text() = New_Text
PropertyChanged "Text"
End Property
-
Jul 31st, 2000, 10:29 AM
#5
Fanatic Member
What is the style of the comboBox?
If it is set to 2, then you will not be able to set the text, as the text is only read only in that scenario.
Iain, thats with an i by the way!
-
Jul 31st, 2000, 12:04 PM
#6
Thread Starter
New Member
Oops. Silly me. I forgot I changed it to a Dropdown List.
Dang, all this coding is getting to my head...
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
|