Results 1 to 10 of 10

Thread: An Ideal option required instead of Listbox. Coud you suggest

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2021
    Posts
    174

    An Ideal option required instead of Listbox. Coud you suggest

    Hello

    What is the ideal object on Windows(App...Vb.net Frame...) Userform instead of Listbox with MultipleColumn and without columncount

    As Columncount is not member of List box in the userform.

    What i would like is to have a replica of listbox of Multiple Columns with a check box as VBA userform had Listbox.Liststyle = frmListStyleoption and in VBA i could add max columns as 10 with below some Critical Properties of Listbox

    Listbox.Multiselect = fmMultiSelect

    Listbox.SpecialEffect = frmSpecialeffectSunken
    Listbox.TextAlign = fmTextAlignLeft
    Listbox.MatchEntry = fmMatchEntryFirstLetter
    Listbox.Columncount = 10
    Listbox.ColumnWidths = "80,55,80,80,100,80,50,35,55"
    With the above listbox it had CheckBox for selection inside. Then Seperate Label.Caption which acted as header and Text inside were placed in such a way that text placed above the columns exactly. So Represented Column Headername.
    With the above listbox had 2 checkoxes seperately in userform for Selection of All items and Unselection of all items

    With the above scenario of Listbox of VBA What would be more Fantastic option me to incorporate the right object in the userform.
    Below Data in another worksheet. And how may columns could be added in that object and formatting of those columns.
    Code:
    Col A      Col B        Col C        Col D      uptlil Col J
    Fruit       Apple          52        240/Kg   ......
    Fruit       Kiwi            24        180/Kg    .....
    Fruit       Pineaapple   36        220/Kg   .....
    Textbox1.Text ="Fruit" then Listbox will display the above data with Full selection with Ticked checkbox

    Thanks
    SamD
    23 Thread 4: 892229
    Last edited by SamDsouza; Jun 12th, 2021 at 04:08 AM.

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,479

    Re: An Ideal option required instead of Listbox. Coud you suggest

    The ListView control can be used as a multi-column ListBox. Set the View property to Details.
    Google it for an example...

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2021
    Posts
    174

    Re: An Ideal option required instead of Listbox. Coud you suggest

    .Paul.
    Thanks for the suggestion let me give it a try and revert back.
    The ListView control can be used as a multi-column ListBox. Set the View property to Details.
    Google it for an example...
    Thanks
    SamD
    24 Thread 4: 892229

  4. #4
    Karen Payne MVP kareninstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    6,686

    Re: An Ideal option required instead of Listbox. Coud you suggest

    If you need some code samples check out the following GitHub repository and article. Code samples use SQL-Server to populate ListView controls yet any database can be used or no database.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    May 2021
    Posts
    174

    Re: An Ideal option required instead of Listbox. Coud you suggest

    Karen

    If you need some code samples check out the following GitHub repository and article. Code samples use SQL-Server to populate ListView controls yet any database can be used or no database.
    Thank you so much for the reference. Yes, will love to go through it and revert back. Mostly queries from my side shall be for MS-Excel at present.
    FYI have gone through your solutions on few of the forums

    Thanks
    SamD
    29 Thread 4: 892229

  6. #6
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,479

    Re: An Ideal option required instead of Listbox. Coud you suggest

    The ListView is not the best choice for displaying from a database. The ListView is a display control, but the DataGridView is designed to be used with databases. There are plenty of properties you can change to alter the appearance of the DataGridView as much or as little as you choose. It can also be used as a read only control, which the ListView would also be.

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    May 2021
    Posts
    174

    Re: An Ideal option required instead of Listbox. Coud you suggest

    Paul
    The ListView is not the best choice for displaying from a database. The ListView is a display control, but the DataGridView is designed to be used with databases. There are plenty of properties you can change to alter the appearance of the DataGridView as much or as little as you choose. It can also be used as a read only control, which the ListView would also be.
    Hmmmm Ok. Seems Very Intresting

    As per your reply#2. I started using ListView.

    Let me know for Viewing an Excel Sheet AsIs will Datagrid be ok ? if not then which is the object to view Excel Sheet. on the userform
    Although there are commands to Open and view the xlsx files.

    Thanks
    SamD
    31 Thread 4: 892229

  8. #8
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,479

    Re: An Ideal option required instead of Listbox. Coud you suggest

    You can query an Excel Worksheet with SQL, then bind it to the DataGridView

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    May 2021
    Posts
    174

    Re: An Ideal option required instead of Listbox. Coud you suggest

    Paul
    You can query an Excel Worksheet with SQL, then bind it to the DataGridView
    Unfortunately no knowledge of SQL. May be leave it here.

    Nevertheless let the oppurtunity come will see at that time.

    SamD
    33 Thread 4: 892229

  10. #10
    PowerPoster ChrisE's Avatar
    Join Date
    Jun 2017
    Location
    Frankfurt
    Posts
    3,048

    Re: An Ideal option required instead of Listbox. Coud you suggest

    Quote Originally Posted by SamDsouza View Post
    Paul

    Unfortunately no knowledge of SQL. May be leave it here.

    Nevertheless let the oppurtunity come will see at that time.

    SamD
    33 Thread 4: 892229
    I gave you a sample with OLEDB .. here ..

    https://www.vbforums.com/showthread....=1#post5524714

    Post#8 you just need to try,use it
    to hunt a species to extinction is not logical !
    since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.

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