Results 1 to 9 of 9

Thread: Combo Box for ActiveX Control

  1. #1

    Thread Starter
    New Member bharadwajrv's Avatar
    Join Date
    Oct 2002
    Location
    Mysore,India
    Posts
    12

    Combo Box for ActiveX Control

    Hi,

    In my ActiveX Control,

    1. One Property of the control take only two values. ie. 'True' or 'False'. for this i wanted to give it in drop down combo box, when they click on that property in the the 'Property' of the my control.

    Ex. 'Visible' property of Textbox control.

    how to code for this...
    thanks in adv...
    Venu
    "Dream it, b'caz U can do it!"

  2. #2
    New Member
    Join Date
    Oct 2002
    Posts
    5

    i think this is what you wish to do?

    In General Declarations section of your user control add:
    Private TheDropDown As Boolean

    In Private Sub Usercontrol_ReadProperties add:
    DropDown= PropBag.ReadProperty("DropDown", False)

    In Private Sub Usercontrol_WriteProperties add:
    PropBag.WriteProperty "DropDown", DropDown, False


    Then after that you add:

    Public Property Get DropDown() As Boolean
    DropDown= TheDropDown
    End Property

    Public Property Let DropDown(ByVal NewValue As Boolean)
    TheDropDown = NewValue
    If DropDown= True Then
    TheDropDown = True
    Else
    TheDropDown = False
    End If

    PropertyChanged "DropDown"
    End Property
    Eric

  3. #3
    New Member
    Join Date
    Oct 2002
    Posts
    5
    replace where i typed DropDown and TheDropDown with whatever you want to name the property of course

    example: ShowIt and TheShowIt
    Eric

  4. #4

    Thread Starter
    New Member bharadwajrv's Avatar
    Join Date
    Oct 2002
    Location
    Mysore,India
    Posts
    12

    thanks

    Thanks Eric...this is what i was looking for. it solved my prob...

    One more help pl... i have one more property by the name "FileName".. it requires the file type like "*.csv" files..

    i wanted to popup "FileOpen" Dialog box.. when the FileName Property is selected... pl. help me in getting this option.

    Thanks in adv...
    Venu
    "Dream it, b'caz U can do it!"

  5. #5
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    Include Microsoft Common Dialog Control component in you form/project. Then use this code
    VB Code:
    1. Public Property Get FileName()
    2.     CommonDialog1.Filter = "CSV Files (*.csv)|*.csv"
    3.     CommonDialog1.ShowOpen
    4. End Property

  6. #6

    Thread Starter
    New Member bharadwajrv's Avatar
    Join Date
    Oct 2002
    Location
    Mysore,India
    Posts
    12

    Wink

    thanks for the help...

    in this code.. when ever i draw this control from tool box to from.. this OpenDialog is poped up..

    i wanted to generate this only when user select this from "Propery window".. and more over in "Propery Window" the a small button with 3 dots(...) should appear to represent that there will be a dialog box on click on this property..

    Ex... 'Picture' property of the Image Control.

    thanks in adv.
    Venu Bharadwaj
    "Dream it, b'caz U can do it!"

  7. #7
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    I am not on a computer which has VB6. I will see it tommorow when I have access to a box with VB6.

  8. #8
    New Member
    Join Date
    Oct 2002
    Posts
    5

    how to add ellipses (3 dots) button to property ....

    hey Venu...this should do what you're asking...

    Article from microsoft knowledge base:

    1) Open the UserControl project in Visual Basic.

    2) From the Tools Menu, click Procedure Attributes. The Procedure Attributes dialog box appears.

    3) In the Procedure Attributes dialog box, click Advanced >>. The Procedure Attributes dialog box expands to display additional attributes

    4) In the Procedure ID listbox, select the name of the property.

    5) In the Use This Page in Property Browser list box, select the property page to displayed for the property. Click Apply to apply this setting, then click OK to close the dialog box.

    The ellipses button should now appear in the container property page. If the form hosting the UserControl is still open in your project, it may be necessary to right-click on the form (in design mode) and select "Update UserControl" to refresh the property window.

    on a further note from me... you can also set the description of each property you add in the procedure attributes dialog ....

    on the subject of "fileopen"...you can use an api call w/o using the control on your project (although using the api creates a dependency the same as using the control itself). i'll post again later when i have more time

    have a great day Venu...
    Eric

  9. #9

    Thread Starter
    New Member bharadwajrv's Avatar
    Join Date
    Oct 2002
    Location
    Mysore,India
    Posts
    12
    Thanks eric, but ....

    i got the ellipses, but i'm getting the data Format Page along with FileOpen Dialog box page...

    any idea.. how to get only FileOen Dialog.. i'm coding FileOpen in the Get Property method...


    Thanks in adv.
    Venu Bharadwaj
    Last edited by bharadwajrv; Oct 21st, 2002 at 04:20 AM.
    "Dream it, b'caz U can do it!"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width