What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Visual Basic 2008 - Reloading/Refreshing Same form

Pages: (2): « First [ 1 ] 2 » Last »
Visual Basic 2008 - Reloading/Refreshing Same form
Author: Message:
Quantum
Disabled Account
*****

Away.

Posts: 1055
Reputation: -17
31 / Male / Flag
Joined: Feb 2007
O.P. Visual Basic 2008 - Reloading/Refreshing Same form
Ok so i have 1 form called Form1.

There is a button on there called b2 and when that's clicked i need it to reload the whole form (form1). I can't figure out a way of doing this. If i do Form1.Exit() then load it or show i can't as it's gone and theres nothing to do it :P

So how can i reload the form?
No longer here.
12-14-2008 06:31 PM
Profile PM Find Quote Report
Stigmata
Veteran Member
*****



Posts: 3520
Reputation: 45
21 / Other / Flag
Joined: Jul 2003
RE: Visual Basic 2008 - Reloading/Refreshing Same form
reload? like start afresh?
Form1.Refresh() not what you want?

or hide it and show it?
Form1.Hide()
Form1.Show()


edit: but in vb2008 you should use me if you are calling it from that form :)

so

Me.Refresh()
Me.Hide()
etc

This post was edited on 12-14-2008 at 07:35 PM by Stigmata.
12-14-2008 07:33 PM
Profile PM Web Find Quote Report
Quantum
Disabled Account
*****

Away.

Posts: 1055
Reputation: -17
31 / Male / Flag
Joined: Feb 2007
O.P. RE: Visual Basic 2008 - Reloading/Refreshing Same form
Ok, i did me.refresh but it's no reloading all the things in the form.

When the form stats it pings 5 servers and displays if there online or offline. I need it to reload it so it pings them i again. This can be done by refreshing the form right?

When i do me.refresh() it does not reload the results :S
No longer here.
12-14-2008 08:27 PM
Profile PM Find Quote Report
vaccination
Veteran Member
*****

Avatar

Posts: 2513
Reputation: 43
32 / Male / –
Joined: Apr 2005
RE: Visual Basic 2008 - Reloading/Refreshing Same form
I believe this will be due to Refresh() only refreshing the graphical elements of the form. If you want to rerun code you'll want to make the button perform a Call function.

However this won't empty the listbox(i presume that's what you're using) and will just append the results to it, you'll need to clear it first.

This post was edited on 12-14-2008 at 08:46 PM by vaccination.
[Image: jumbled.png]
12-14-2008 08:44 PM
Profile PM Find Quote Report
Quantum
Disabled Account
*****

Away.

Posts: 1055
Reputation: -17
31 / Male / Flag
Joined: Feb 2007
O.P. RE: Visual Basic 2008 - Reloading/Refreshing Same form
Can you give me an example?
No longer here.
12-14-2008 08:50 PM
Profile PM Find Quote Report
Stigmata
Veteran Member
*****



Posts: 3520
Reputation: 45
21 / Other / Flag
Joined: Jul 2003
RE: Visual Basic 2008 - Reloading/Refreshing Same form
put the ping'ing stuff, loading list box etc in a procedure.

call the procedure on form load, call it again after the button press?
12-14-2008 08:54 PM
Profile PM Web Find Quote Report
vaccination
Veteran Member
*****

Avatar

Posts: 2513
Reputation: 43
32 / Male / –
Joined: Apr 2005
RE: Visual Basic 2008 - Reloading/Refreshing Same form
Yeah, basically.

code:
Public Class form1

   Private sub Ping()
  -code-
   End Sub

   Private sub Button_Click() Handles Button.Click
   Call Ping()
   End Sub


That's very basic, but something like that.
[Image: jumbled.png]
12-14-2008 09:06 PM
Profile PM Find Quote Report
Quantum
Disabled Account
*****

Away.

Posts: 1055
Reputation: -17
31 / Male / Flag
Joined: Feb 2007
O.P. RE: Visual Basic 2008 - Reloading/Refreshing Same form
Ok well the code for that form starts like

code:
Private Sub main1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Then my

code:
If My.Computer.Network.Ping("xx.xxx.xx.xx") Then
            PictureBox1.Show()
        Else
            PictureBox10.Show()
        End If

(there more than one)

It ends with the usual

code:
End Sub

How do i add it in? I can't seem to do it without errors :P :S



This post was edited on 12-14-2008 at 10:00 PM by Quantum.
No longer here.
12-14-2008 09:59 PM
Profile PM Find Quote Report
Stigmata
Veteran Member
*****



Posts: 3520
Reputation: 45
21 / Other / Flag
Joined: Jul 2003
RE: Visual Basic 2008 - Reloading/Refreshing Same form
are you learning vb atm?


Look up procedures :)

It's prob better its something you lookup and learn yourself because you'll find it useful in future :)
12-14-2008 10:01 PM
Profile PM Web Find Quote Report
Quantum
Disabled Account
*****

Away.

Posts: 1055
Reputation: -17
31 / Male / Flag
Joined: Feb 2007
O.P. RE: Visual Basic 2008 - Reloading/Refreshing Same form
Ok, i've got it partly working.

When the form loads this command is given:

code:
Call Ping()


And when the button is pressed that does the same command.

The code inside Ping() pings a server and makes a image visible if it gets a response or else makes an image next to it visible if there no response.

But if all servers are online there will be a list of images visable. Fair enough untill i refresh that list by pressing the button with

Call Ping()

in it and if a server is offline it will make the offline and online image active.

Do you get me.

So when the form loads there is

1 IMAGE
2 IMAGE
3 IMAGE
4 IMAGE
5 IMAGE

And if i refresh and one goes offline its like

1 IMAGE
2 IMAGE IMAGE
3 IMAGE
4 IMAGE
5 IMAGE

When i need it to be

1 IMAGE
2              IMAGE
3 IMAGE
4 IMAGE
5 IMAGE



No longer here.
12-14-2008 10:17 PM
Profile PM Find Quote Report
Pages: (2): « First [ 1 ] 2 » Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On