Jump to content
ferreira12

Listview Timer

Recommended Posts

ferreira12

Olá.

Tenho um Listbox e queria que ela me actualiza-se automaticamente de 5 em 5 segundos.

LstViewDiferencas.Items.Clear()
LstViewDiferencas.Visible = True
LerListView(LstViewDiferencas, "select * from teste")

Como é que coloco um timer a fazer o refresh automaticamente? Ou existe outra alternativa mais fácil?

Edited by ribeiro55

Share this post


Link to post
Share on other sites
ribeiro55

Coloca o Timer a partir da Toolbox e dá-lhe dois cliques.

Isto vai abrir-te o painel de código com um bloco auto-criado.

Este bloco é o handler do evento Tick, ou seja, é o código que vai correr sempre que o Timer disparar.

Neste caso, podes colocar essas 3 linhas dentro desse Sub.

Depois disto, nas propriedades do Timer, coloca o interval a 5000 (~5000 msegs = ~5 seg) e passa o Enabled para True.


Sérgio Ribeiro


"Great coders aren't born. They're compiled and released"
"Expert coders do not need a keyboard. They just throw magnets at the RAM chips"

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.