Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
430 views
in Technique[技术] by (71.8m points)

how can I add clock on visual basic form

I wanted to include time on my form in visual basic 2010 environment. These are the four different codes I used but I am still not seeing the clock(I only sees the text on the control) TextBox1.Text = TimeOfDay() TextBox1.Text = DateTime.Now.TimeOfDay.ToString() Label1.Text = TimeOfDay() Label1.Text = DateTime.Now.TimeOfDay.ToString()

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Visual Basic programming is so simple that sometime you just need to write a one line code to create a wonderful tiny little but nice application. For example, you can write a one-line code to create a digital cock.

In this program, you have to insert a timer control into the form . Then go to the properties window to set the timer's interval value to 1000 so that Visual Basic updates the time every 1000 milliseconds, or once a second. Other properties that you ought to set are to change the caption such as "My Cock" and to set Form1's MaxButton to false so that it cannot be resized by the user. The Design Interface

The Run Time Interface

Now, double click the timer and enter the one line code as follows:

     Private Sub freeclockdotjpeg()


              cocklabel.Caption = Time


       End Sub

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...