i have a problem regarding timer in the listbox. it suppose the time and date have to appear once only but it appear a non stop in listbox when run.

here is the code:

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        ListBox1.Items.Add(TimeString)
        ListBox1.Items.Add(DateString)
    End Sub

here is i attach the picture.


also i want to know the code for 'day', like monday, tuesday and etc.

hope you guys help solve this problem.

Hi,

For your first question.
It's working normal because you put it in the Timer Event.
That means every second the timer execute you'll have an item added into the Listbox.

What you can do is change the timer interval to the executiontime you need or put it into a Button event instead of timer.

For your second question, try this:

TextBox1.Text = Date.Now.DayOfWeek.ToString

ok. thank you very much for the help. i appreciate the help. thanks again

Hi,

No problem :)
Mark this thread as resolved and rating is a way of saying thank you. Don't forget to rate always, thanks. :)

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.