Results 1 to 3 of 3

Thread: [2005] String to Brush???

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2008
    Posts
    33

    [2005] String to Brush???

    Hey I'm making a very basic paint program and I wanted to make it so you could put in any color into a combobox and set the color to a brush, but what I have is:

    vb Code:
    1. myBrush = "Brushes." + ComboBox2.Text
    2. DrawBrush = myBrush

    Although, obviously it dosn't work, can anyone help???
    Languages:
    C - Journyman
    VB - Ameture

  2. #2
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: [2005] String to Brush???

    Try this;
    VB.NET Code:
    1. Dim myBrush As SolidBrush
    2.         myBrush = New SolidBrush(Color.FromName(ComboBox2.Text))
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  3. #3

    Thread Starter
    Member
    Join Date
    Mar 2008
    Posts
    33

    Re: [2005] String to Brush???

    Thank You. That worked perfectaly
    Languages:
    C - Journyman
    VB - Ameture

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