D
D. Shane Fowlkes
I'm trying to use some basic logic (in a goof off test page) so when a
form's data is evaluted, the color of a label **might** be red. The error I
keep getting is:
Compiler Error Message: BC30311: Value of type 'String' cannot be converted
to 'System.Drawing.Color'.
Line 15: MyMessage.Forecolor = "#FF0000"
Would someone mind looking at and suggesting a fix for my code. I'm having
a hard time getting a working example to learn from and experiment with....
Thanks!
<% @Page Explicit="True" Language="VB" Debug="True" %>
<%@ Import NameSpace = "System.Drawing.Color" %>
<html>
<script runat="server">
Sub OKButton_Click(Sender As Object, E As EventArgs)
Dim UserAge As Integer
Dim DogAge As Integer
UserAge = MyAge.Text
DogAge = UserAge / 7
If UserAge > 200 Then
MyMessage.Text="If you were a dog, you'd be " & DogAge & " years old
and you're too old."
MyMessage.Forecolor = "#FF0000"
Else
MyMessage.Text="If you were a dog, you'd be " & DogAge & " years old."
End If
End Sub
</script>
<body>
<h1>If You Were A Dog</h1>
<form runat="server">
How old are you?<br />
<asp:textbox id="MyAge" runat="server" />
<asp:button text="OK" onclick="OKButton_Click" runat="server"/><br>
<asp:label id="MyMessage" runat="server" />
</form>
</body>
</html>
--
*********************************
D. Shane Fowlkes - TMM
Saving the world, one web site at a time.
http://www.shanefowlkes.com
*********************************
form's data is evaluted, the color of a label **might** be red. The error I
keep getting is:
Compiler Error Message: BC30311: Value of type 'String' cannot be converted
to 'System.Drawing.Color'.
Line 15: MyMessage.Forecolor = "#FF0000"
Would someone mind looking at and suggesting a fix for my code. I'm having
a hard time getting a working example to learn from and experiment with....
Thanks!
<% @Page Explicit="True" Language="VB" Debug="True" %>
<%@ Import NameSpace = "System.Drawing.Color" %>
<html>
<script runat="server">
Sub OKButton_Click(Sender As Object, E As EventArgs)
Dim UserAge As Integer
Dim DogAge As Integer
UserAge = MyAge.Text
DogAge = UserAge / 7
If UserAge > 200 Then
MyMessage.Text="If you were a dog, you'd be " & DogAge & " years old
and you're too old."
MyMessage.Forecolor = "#FF0000"
Else
MyMessage.Text="If you were a dog, you'd be " & DogAge & " years old."
End If
End Sub
</script>
<body>
<h1>If You Were A Dog</h1>
<form runat="server">
How old are you?<br />
<asp:textbox id="MyAge" runat="server" />
<asp:button text="OK" onclick="OKButton_Click" runat="server"/><br>
<asp:label id="MyMessage" runat="server" />
</form>
</body>
</html>
--
*********************************
D. Shane Fowlkes - TMM
Saving the world, one web site at a time.
http://www.shanefowlkes.com
*********************************