Results 1 to 7 of 7

Thread: Question about adding Text into Listbox

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2007
    Posts
    95

    Question about adding Text into Listbox

    Hello guys. I'm trying to write a program in such a way that when the user types a message in Textbox A, it will add the message into the Listbox in Red color. While when the same user types the message in Textbox B, the message will be added to the Listbox in Blue color. How do I do this?

  2. #2
    Lively Member Arty2000's Avatar
    Join Date
    Nov 2006
    Location
    Australia
    Posts
    100

    Re: Question about adding Text into Listbox

    Wouldn't you just change the forecolor property?

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

    Re: Question about adding Text into Listbox

    Quote Originally Posted by zabimaru
    Hello guys. I'm trying to write a program in such a way that when the user types a message in Textbox A, it will add the message into the Listbox in Red color. While when the same user types the message in Textbox B, the message will be added to the Listbox in Blue color. How do I do this?
    This can be done if you want to deal with about a mile and a half of code. See Aaron Youngs code here

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

    Re: Question about adding Text into Listbox

    Quote Originally Posted by Arty2000
    Wouldn't you just change the forecolor property?
    No. The back and forecolor properties of the standard VB listbox deal with the control as a whole. Not just a single entry.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jan 2007
    Posts
    95

    Re: Question about adding Text into Listbox

    Omg! That was pretty sick! Haha... So there's no simpler way of adding different colored text to the same listbox?

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

    Re: Question about adding Text into Listbox

    Quote Originally Posted by zabimaru
    Omg! That was pretty sick! Haha... So there's no simpler way of adding different colored text to the same listbox?
    No...and until I ran into Aaron's post, I didn't think it was possible at all.

  7. #7
    Lively Member Arty2000's Avatar
    Join Date
    Nov 2006
    Location
    Australia
    Posts
    100

    Re: Question about adding Text into Listbox

    No. The back and forecolor properties of the standard VB listbox deal with the control as a whole. Not just a single entry.
    Oh yeah... (cough)... I knew that

    zabimaru maybe this will help?

    http://vbaccelerator.com/home/VB/Cod...ox/article.asp

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