Displaying Web Forms

jerry78

New member
Joined
Nov 27, 2004
Messages
1
Programming Experience
1-3
I am new to VB.NET and ASP.NET and I am using a Deitel book in an attempt to learn a bit. Anyway, I am trying to display web forms in a browser but am having difficulty.

I have two labels (a title and system time) on the forms but when I run the browser, only one displays. I assume that the problem is not a "setup" thing since one label does display. Suggestions?

Here's the application snippet:

Public Class WebForm1

Inherits System.Web.UI.Page

Protected WithEvents displayLabel As System.Web.UI.WebControls.Label

Protected WithEvents timeLabel As System.Web.UI.WebControls.Label

#
Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.

<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init

'CODEGEN: This method call is required by the Web Form Designer

'Do not modify it using the code editor.

InitializeComponent()

timeLabel.Text =
String.Format("{0:D2}:{1:D2}:{2:D2}", _

DateTime.Now.Hour, DateTime.Now.Minute, _

DateTime.Now.Second)

End Sub

#End Region

End
Class

 

Tom Chesley

Member
Joined
Jun 18, 2006
Messages
12
Programming Experience
1-3
i used that same book, and got mine to work in the page init area, but the code you have has smileys in it.
I had:
VB.NET:
timeLabel.Text = String.Format("{0:D2}:{1:D2}:{2:D2}",
and so on
You probably had that but didnt do the code tags so it put the smileys in it.... Ill play with it again as a new project from the book... its been to long to remember how i got it to work
 
Last edited:
Top Bottom