Results 1 to 9 of 9

Thread: [RESOLVED] Converting cmb.ItemData(cmb.NewIndex) into Microsoft Forms 2.0 Object Library Control

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2005
    Posts
    19

    Resolved [RESOLVED] Converting cmb.ItemData(cmb.NewIndex) into Microsoft Forms 2.0 Object Library Control

    Im currently converting VB.ComboBox to MSForms.ComboBox due to unicode issue.

    Is there anyway to imitate the following code?

    Code:
    cmb.ItemData(cmb.NewIndex) = 0
    MSForms.ComboBox doesn't support .ItemData and .NewIndex anymore.
    I'm greatly appreciate for responses

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Converting cmb.ItemData(cmb.NewIndex) into Microsoft Forms 2.0 Object Library Control

    you could try using a hidden column in the combobox as forms2 combo support multi column
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Converting cmb.ItemData(cmb.NewIndex) into Microsoft Forms 2.0 Object Library Control

    Are you are aware that MS Forms 2.0 are not redistributable?

  4. #4
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    Re: Converting cmb.ItemData(cmb.NewIndex) into Microsoft Forms 2.0 Object Library Control

    Darn, I don't have a ComboBox control yet that I could advertise! Anyways, there is atleast one freely usable Unicode ComboBox control at Planet Source Code. If you're looking for other controls, I have a textbox, listbox and a label done, but they're not final/stable releases yet.

    The advantage over Forms 2.0 is that the syntax is compatible and the controls are freely distributable/usable.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Dec 2005
    Posts
    19

    Re: Converting cmb.ItemData(cmb.NewIndex) into Microsoft Forms 2.0 Object Library Control

    I do aware of MS Forms 2.0 is not redistributable.

    The application comes along with microsoft office so its not a problem at all

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Dec 2005
    Posts
    19

    Re: Converting cmb.ItemData(cmb.NewIndex) into Microsoft Forms 2.0 Object Library Control

    I use multiple column approach, it works!

    Code:
    cmb.BoundColumn = 1
    cmb.ColumnCount = 2
    cmb.TextColumn = 1
    cmb.Column(1, cmb.ListCount - 1) = 0
    the .TextColumn is for which column to be displayed in selected list

    But i got another issue which is to show only 1 column in populated combobox.
    I can find any column hide function for that. Any idea?

  7. #7
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Converting cmb.ItemData(cmb.NewIndex) into Microsoft Forms 2.0 Object Library Control

    make the width of the first column the width of the combo
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  8. #8

    Thread Starter
    Junior Member
    Join Date
    Dec 2005
    Posts
    19

    Re: Converting cmb.ItemData(cmb.NewIndex) into Microsoft Forms 2.0 Object Library Control

    Found the solution

    Code:
    cmb.ColumnWidths = "450pt;0pt"
    Works like charm! Thanks guys

  9. #9
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Converting cmb.ItemData(cmb.NewIndex) into Microsoft Forms 2.0 Object Library Control

    Thread moved

    Sounds like you are doing this in Access VBA anyways so the end user will need Access installed at a minimium.

    Ps, dont forget to Resolve your thread from the Thread Tools menu so others know your question has been answered.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

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