Login
|
Webmail
|
Support
|
480-388-3777
Let's Chat
Infrastructure As A Service (IaaS)
Managed Hosting Overview
High Availability & Load Balancing
Data Storage
Disaster Recovery & Backup
All-In-One/DDOS Attack Protection
Security
Management Services
Email Solutions
Hosted / Encrypted Email
Enterprise / Encrypted Email
Partners Overview
Preferred Partners
Managed Hosting Overview
Managed Servers
Self-Managed Servers
Shared Website Hosting
Hosted / Encrypted Email
Domain Names
Company Overview
Leadership Team
Brinkster News
Careers
Data Center
Network
Legal
Corporate Social Responsibility
Contact Brinkster
change color
Added By:
onestepup
Rated:
(3 of 5) by 5.
Rate Snippet:
1
2
3
4
5
Description:
Change color
Language:
Visual Basic .NET
Save to web space
E-mail Link
Code Snippet:
<%@ Page Language="VB" debug=true%> <%@ Import Namespace="System.Drawing.Color" %>
Red
Blue
Green
Yellow
This is an amazing little bit of code. I want to set the color of the label to the selection in the listbox. This exhibits two problems. First, I want to set the ForeColor property to the initial color. But I can't get the selected property in the Page_Load subroutine. At Page_Load time, it is not available.
So, I set it explicitly with Me.lblMessage.ForeColor = Blue. Be sure to Import Namespace="System.Drawing.Color", otherwise Blue (or any other color) is not available. Also, strings such as "Blue" are not recognized by System.Drawing.Color, you actually need to use the word in your code, but you can't accept a user string. Therefore, I used a
tag to place the string color word and change the color. I think that this task would actually be eaiser with asp 3.0.
Toll free:
1 (800) 345-7084