Results 1 to 12 of 12

Thread: [RESOLVED] Show 2 controls as selected at same time

  1. #1

    Thread Starter
    Frenzied Member aikidokid's Avatar
    Join Date
    Aug 2002
    Location
    Bristol, UK
    Posts
    1,968

    Resolved [RESOLVED] Show 2 controls as selected at same time

    I have a text box and a listview.
    When the user types into the text box it searches the listview for any matches. (Auto-complete)

    What I would like to be able to do is have both the text in the textbox and the selected item in the listview highlighted, as in the picture below, preferably keeping the focus on the textbox.

    Anybody know how to do this? I am guessing some osrt of API call.
    Attached Images Attached Images  
    If somebody helps you, take time to RATE the post. I do.

    "FAILURE IS NOT AN OPTION. It comes bundled with the software."

    Below are some of the threads that have helped me along the way:

    CodeBank submission:
    Listview Backcolor (without subclassing)

    Loading Treeview Nodes From A Database, Creating Registry Keys, Count Number of Lines in TextBox , Excellent RichTextBox Tricks & Tips
    Ideas & Screen Shots For A Code Library App
    How to do Data validation in Excel, Conditional Formating in Excel

  2. #2

  3. #3

    Thread Starter
    Frenzied Member aikidokid's Avatar
    Join Date
    Aug 2002
    Location
    Bristol, UK
    Posts
    1,968

    Re: Show 2 controls as selected at same time

    Doesn't this select the Listview, but not in the 'Blue' highlighted colour?

    I was hoping to get both the same, as in the picture.

    I can't quite test it yet as I am having trouble here in this thread (Thread sorted now)
    Last edited by aikidokid; Jun 5th, 2007 at 09:56 AM.
    If somebody helps you, take time to RATE the post. I do.

    "FAILURE IS NOT AN OPTION. It comes bundled with the software."

    Below are some of the threads that have helped me along the way:

    CodeBank submission:
    Listview Backcolor (without subclassing)

    Loading Treeview Nodes From A Database, Creating Registry Keys, Count Number of Lines in TextBox , Excellent RichTextBox Tricks & Tips
    Ideas & Screen Shots For A Code Library App
    How to do Data validation in Excel, Conditional Formating in Excel

  4. #4
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Re: Show 2 controls as selected at same time

    You could use a listbox instead of a listview. Assuming you don't want to do that, I know you can set the color of listview items. Not sure if that includes the background color, but I imagine it might.

  5. #5
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: Show 2 controls as selected at same time

    Quote Originally Posted by aikidokid
    Doesn't this select the Listview, but not in the 'Blue' highlighted colour?
    It keeps the selected text highlighted even when the control looses focus.
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

  6. #6
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Re: Show 2 controls as selected at same time

    That's a gray highlight, not the standard blue one. (Inactive highlight.)

  7. #7
    Frenzied Member zynder's Avatar
    Join Date
    Nov 2006
    Location
    localhost
    Posts
    1,434

    Re: Show 2 controls as selected at same time

    I have posted some samples here.

    http://www.vbforums.com/showthread.php?t=472166

  8. #8

    Thread Starter
    Frenzied Member aikidokid's Avatar
    Join Date
    Aug 2002
    Location
    Bristol, UK
    Posts
    1,968

    Re: Show 2 controls as selected at same time

    Quote Originally Posted by zynder
    I have posted some samples here.

    http://www.vbforums.com/showthread.php?t=472166
    Thanks zynder, I have just been looking at them

    So, in your original post (2006) did you end up using a ListBox instead, or did you settle for not having the ListView highlighted the same as the ListBox image?
    If somebody helps you, take time to RATE the post. I do.

    "FAILURE IS NOT AN OPTION. It comes bundled with the software."

    Below are some of the threads that have helped me along the way:

    CodeBank submission:
    Listview Backcolor (without subclassing)

    Loading Treeview Nodes From A Database, Creating Registry Keys, Count Number of Lines in TextBox , Excellent RichTextBox Tricks & Tips
    Ideas & Screen Shots For A Code Library App
    How to do Data validation in Excel, Conditional Formating in Excel

  9. #9
    Frenzied Member zynder's Avatar
    Join Date
    Nov 2006
    Location
    localhost
    Posts
    1,434

    Re: Show 2 controls as selected at same time

    I used listbox instead. I didn't bother to mimic the effects of listbox to a listview control. You see, the highlight color isnt blue but gray. But i know you can subclass it and actually draw the color you want but i dont want get myself into more trouble.

    So i ended up using listbox and the autocomplete is perfect. But in your case since you're using multi columns better stick to listview although you can span it in listbox using vbTab. Well, it's up to you.

  10. #10

    Thread Starter
    Frenzied Member aikidokid's Avatar
    Join Date
    Aug 2002
    Location
    Bristol, UK
    Posts
    1,968

    Re: Show 2 controls as selected at same time

    Quote Originally Posted by zynder
    I used listbox instead. I didn't bother to mimic the effects of listbox to a listview control. You see, the highlight color isnt blue but gray. But i know you can subclass it and actually draw the color you want but i dont want get myself into more trouble.

    So i ended up using listbox and the autocomplete is perfect. But in your case since you're using multi columns better stick to listview although you can span it in listbox using vbTab. Well, it's up to you.
    I think I will have a little play with it and see what I end up with.

    Thanks for your help and the code samples
    If somebody helps you, take time to RATE the post. I do.

    "FAILURE IS NOT AN OPTION. It comes bundled with the software."

    Below are some of the threads that have helped me along the way:

    CodeBank submission:
    Listview Backcolor (without subclassing)

    Loading Treeview Nodes From A Database, Creating Registry Keys, Count Number of Lines in TextBox , Excellent RichTextBox Tricks & Tips
    Ideas & Screen Shots For A Code Library App
    How to do Data validation in Excel, Conditional Formating in Excel

  11. #11
    Frenzied Member zynder's Avatar
    Join Date
    Nov 2006
    Location
    localhost
    Posts
    1,434

    Re: Show 2 controls as selected at same time

    No problem dude. If you have any problems just let us know.

  12. #12

    Thread Starter
    Frenzied Member aikidokid's Avatar
    Join Date
    Aug 2002
    Location
    Bristol, UK
    Posts
    1,968

    Re: Show 2 controls as selected at same time

    Changed the form and code about a bit and now I have what I was after, but using the listbox, not the listview.

    Thanks all who helped
    If somebody helps you, take time to RATE the post. I do.

    "FAILURE IS NOT AN OPTION. It comes bundled with the software."

    Below are some of the threads that have helped me along the way:

    CodeBank submission:
    Listview Backcolor (without subclassing)

    Loading Treeview Nodes From A Database, Creating Registry Keys, Count Number of Lines in TextBox , Excellent RichTextBox Tricks & Tips
    Ideas & Screen Shots For A Code Library App
    How to do Data validation in Excel, Conditional Formating in Excel

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