i've just started doing asp.net i am good in vb.net but i've encountered a challenge.First of all isnt it supposed to be private sub not protected.As you can see i want to output a message on the label which is green but i am getting an error saying green is not declared. can someone help

Partial Public Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'Response.Write("Hey, my page is loaded ...")
        'Label1.Text = "Welcome to my First ASP.NET Page. Current Server time is " & DateTime.Now.ToString()
        Label1.ForeColor = Color.FromName("GREEN")
        Label1.Text = "Successfully processed."

    End Sub

End Class

Recommended Answers

All 2 Replies

It should be
Label1.Forecolor = Color.Green;
remove the from name , just use the enum value

and also import the System.Drawing class

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.