How to update button form or event automatically?

Asked

Viewed 1,273 times

0

How do I update a Private Sub _PAINEL_VENDAS_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load automatically and an event for example button?

I have to use a timer?

  • I couldn’t understand what you want to do, you want to create a method for when you click the button?

  • I want you to automatically call a form button every 60 seconds.

  • Or would you like the form ( load ) to update itself every 60 seconds.

  • I apologize for not explaining it properly and I hope you understand now.

1 answer

1

Try this on:

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        ' Aqui seu codigo do botao
    End Sub

    Private Sub _PAINEL_VENDAS_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load    
        Dim timer = New Timer
        timer.Interval = 2 * 1000 ' 2 segundos
        AddHandler timer.Tick, AddressOf Button1_Click
        timer.Start()
    End Sub
  • Thank you. It worked.

  • @user2979215 If possible select my answer as the solution to your problem, so help new users who arrive here later.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.