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:
Stigmata
Veteran Member
*****



Posts: 3522
Reputation: 45
16 / Other / Flag
Joined: Jul 2003
RE: Visual Basic 2008 - Reloading/Refreshing Same form
then hide the images you don't want to show?

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

        Else
            PictureBox10.Show()
            PictureBox1.Hide()
End If


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

Away.

Posts: 1055
Reputation: -17
25 / Male / Flag
Joined: Feb 2007
O.P. RE: Visual Basic 2008 - Reloading/Refreshing Same form
What like

If My.Computer.Network.Ping("xx.xxx.xx.xx") Then
            PictureBox1.Show()

        Else
            PictureBox10.Show()
            PictureBox1.Hide()
End If
No longer here.
12-14-2008 10:21 PM
Profile PM Find Quote Report
Stigmata
Veteran Member
*****



Posts: 3522
Reputation: 45
16 / Other / Flag
Joined: Jul 2003
RE: Visual Basic 2008 - Reloading/Refreshing Same form
nope, like what I showed you :)
12-14-2008 10:26 PM
Profile PM Web Find Quote Report
Quantum
Disabled Account
*****

Away.

Posts: 1055
Reputation: -17
25 / Male / Flag
Joined: Feb 2007
O.P. RE: Visual Basic 2008 - Reloading/Refreshing Same form
I did that but if one is online then offline then online, 2 images are shown.. :S
No longer here.
12-14-2008 10:30 PM
Profile PM Find Quote Report
vaccination
Veteran Member
*****

Avatar

Posts: 2515
Reputation: 41
27 / Male / –
Joined: Apr 2005
RE: Visual Basic 2008 - Reloading/Refreshing Same form
Just completely clear all the images inside your ping Sub. That way when you call it they'll all be generated right.

[so, in your Sub Ping() your first bit of code will be PictureBox1.Hide(), PictureBox2.Hide() etc, then you have your ping stuff + showing the pictures]
[Image: jumbled.png]
12-15-2008 10:06 AM
Profile PM Find Quote Report
Quantum
Disabled Account
*****

Away.

Posts: 1055
Reputation: -17
25 / Male / Flag
Joined: Feb 2007
O.P. RE: Visual Basic 2008 - Reloading/Refreshing Same form
Thanks :D

Got it working :P

If i ping a server sometimes  the ping messes up and it detects the server as offline. It's not though. Is there a better way to see if a server is offline or online?
No longer here.
12-15-2008 05:56 PM
Profile PM Find Quote Report
Ezra
Veteran Member
*****

Avatar
Forgiveness is between them and God

Posts: 1960
Reputation: 31
32 / Male / Flag
Joined: Mar 2003
RE: Visual Basic 2008 - Reloading/Refreshing Same form
quote:
Originally posted by Quantum
If i ping a server sometimes  the ping messes up and it detects the server as offline. It's not though. Is there a better way to see if a server is offline or online?

check if the service that it is providing is working, so a http server, try to download the index page, or just a HEAD request (will save bandwidth), ftp try to connect, etc...

This post was edited on 12-15-2008 at 07:14 PM by Ezra.
[Image: 1-0.png]
             
12-15-2008 07:14 PM
Profile PM Web Find Quote Report
pillowmurder
New Member
*


Posts: 1
Joined: Jan 2009
RE: Visual Basic 2008 - Reloading/Refreshing Same form
very simple to reload a form.

use another form, in it have this code execute either by load or another objects method.

form1.close() 'form you want reloaded closes
form1.visible = true  'form you want reloaded opens
form2.close() 'form that did the reload closes



yours,
PM
01-10-2009 03:43 AM
Profile E-Mail PM Find Quote Report
andrewdodd13
Senior Member
****

Avatar
Oh so retro

Posts: 870
Reputation: 16
29 / Male / Flag
Joined: Jan 2005
RE: RE: Visual Basic 2008 - Reloading/Refreshing Same form
quote:
Originally posted by pillowmurder
very simple to reload a form.

use another form, in it have this code execute either by load or another objects method.

form1.close() 'form you want reloaded closes
form1.visible = true  'form you want reloaded opens
form2.close() 'form that did the reload closes



yours,
PM
This shouldn't work in VB 2008, because forms are now stored as classes rather than objects, so form1 is the class.

What you would be better off doing, is making a module, and using Sub Main and having a global in the module called form1Instance, code like this:

Visual Basic code:
Dim form1Instance As Form1
 
Sub Main
  form1Instance = new Form1
  form1Instance.Show()
End Sub
 
Sub Reset
  form1Instance.close()
  form1Instance.show()
End Sub

To Reset the form, call Module1.Reset. At least... it should work. :P
[Image: AndrewsStyle.png]
01-10-2009 11:48 AM
Profile E-Mail PM Web Find Quote Report
BV
New Member
*

BV

Posts: 1
Joined: Feb 2013
RE: Visual Basic 2008 - Reloading/Refreshing Same form
Hi in case your still interested in finding the solution for this.

This is what worked for me.

I needed to refresh the data that the form has, but the microsoft refresh button is not doing the trick, so here is what i did:

I created a sub procedure called "loadReport", which must happen at form load, and on click event of refresh button.

Here is how my code looks like:

Private Sub loadReport()
        Try
            'TODO: This line of code loads data into the 'myDataSet.Events' table. You can move, or remove it, as needed.
            Me.EventsTableAdapter.Fill(Me.myDataSet.Events)
            'TODO: This line of code loads data into the 'myDataSet.eventtable' table. You can move, or remove it, as needed.
            Me.eventtableTableAdapter.Fill(Me.myDataSet.eventtable)
            ' Me.EventsTableAdapter.Fill(Me.myDataSet.Events)
            Me.ReportViewer1.RefreshReport()
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'       Call the sub procedure on form load
        loadReport()
    End Sub

Private Sub btnRefresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRefresh.Click
        'Call the sub procedure on refresh button
        loadReport()
    End Sub;)
02-08-2013 08:59 AM
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