Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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

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

1 Answer

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...