Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 150,140 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 2,297 people online right now. Registration is fast and FREE... Join Now!




Multi-Forms VB.NET 2005

 
Reply to this topicStart new topic

Multi-Forms VB.NET 2005, Update labels in Form2 from Form1

rablake
17 Jul, 2008 - 04:40 AM
Post #1

New D.I.C Head
*

Joined: 17 Jul, 2008
Posts: 1

Form1
---------------------
CODE

Friend SkyDome As New frmSkyDome()

Private Sub btnSkyDome_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSkyDome.Click
        (Some Calcs that define global variables used to update Labels)
        SkyDome.Show()
End Sub




Form2: frmSkyDome
---------------------
CODE

frmSkyDome.Topmost=TRUE

Private Sub frmSkyDome_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
        LoadSkyDomeLabels()
End Sub

Friend Sub LoadSkyDomeLabels()
  (Does calcs and loads labels)
End Sub



It runs the fisrt time fine. But labels won't update when new global variables are calculated in Form1 unless I close Form2 and reopen it. I want them to update live.
User is offlineProfile CardPM
+Quote Post

tody4me
RE: Multi-Forms VB.NET 2005
17 Jul, 2008 - 05:53 AM
Post #2

Only Jenny Craig makes thin clients...
Group Icon

Joined: 12 Apr, 2006
Posts: 1,349



Thanked: 5 times
Dream Kudos: 100
My Contributions
When you hide the form it's not reloading. You have to dispose of the form for it to go out of memory and reload.

This post has been edited by tody4me: 17 Jul, 2008 - 05:54 AM
User is offlineProfile CardPM
+Quote Post

Jayman
RE: Multi-Forms VB.NET 2005
17 Jul, 2008 - 07:50 AM
Post #3

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 7,319



Thanked: 66 times
Dream Kudos: 500
Expert In: Everything

My Contributions
Please use code.gif tags when posting code. thanks.
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Multi-Forms VB.NET 2005
17 Jul, 2008 - 08:31 AM
Post #4

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 9,483



Thanked: 161 times
Dream Kudos: 9075
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
This code is in VB.NET, so I'm moving this to the VB.NET Forum so it can get the proper attention smile.gif
User is offlineProfile CardPM
+Quote Post

AdamSpeight2008
RE: Multi-Forms VB.NET 2005
17 Jul, 2008 - 09:11 AM
Post #5

LINQ D.I.C.
Group Icon

Joined: 29 May, 2008
Posts: 863



Thanked: 54 times
Dream Kudos: 2250
My Contributions
QUOTE(rablake @ 17 Jul, 2008 - 01:40 PM) *

Form1
---------------------
CODE

Friend SkyDome As New frmSkyDome()

Private Sub btnSkyDome_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSkyDome.Click
        (Some Calcs that define global variables used to update Labels)
        SkyDome.Show()
End Sub




Form2: frmSkyDome
---------------------
CODE

frmSkyDome.Topmost=TRUE

Private Sub frmSkyDome_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
        LoadSkyDomeLabels()
End Sub

Friend Sub LoadSkyDomeLabels()
  (Does calcs and loads labels)
End Sub



It runs the fisrt time fine. But labels won't update when new global variables are calculated in Form1 unless I close Form2 and reopen it. I want them to update live.



When you do the calculation in form1.
Add;-
vb

<Name of Form2>.Refresh

This will force Form2 to be repainted, which it turn will update the labels.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 02:13AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month