|
-
Jul 5th, 2004, 08:03 PM
#1
Thread Starter
PowerPoster
Color Property (Resolved)
Hi,
Can I use a string variable to set a color property of a control? e.g.
strCol="Color.Red"
Textbox1.BackColor=strcol (which of course does not work)
Last edited by taxes; Jul 6th, 2004 at 06:07 AM.
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Jul 5th, 2004, 08:38 PM
#2
VB Code:
Dim c As Color = CType(TypeDescriptor.GetConverter(GetType(Color)).ConvertFromString("Red"), _
Color)
Me.BackColor = c
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Jul 5th, 2004, 08:53 PM
#3
Fanatic Member
in addition to master crptcblade
VB Code:
Dim s As String = "Brown" 'Monkey
Me.BackColor = Color.FromName(s)
Last edited by brown monkey; Jul 5th, 2004 at 09:24 PM.
-
Jul 5th, 2004, 09:29 PM
#4
Originally posted by brown monkey
in addition to master crptcblade
VB Code:
Dim s As String = "Brown" 'Monkey
Me.BackColor = Color.FromName(s)
Didn't even notice that method. Even better.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Jul 5th, 2004, 09:36 PM
#5
Fanatic Member
cheers master
-
Jul 6th, 2004, 06:06 AM
#6
Thread Starter
PowerPoster
Hi,
Many thanks to you both.
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|