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.

Edited 5 Years Ago by ayoba01: n/a

Attachments listbox.png 4.87 KB

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

Edited 5 Years Ago by Luc001: n/a

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. :)

This question has already been answered. Start a new discussion instead.