473,394 Members | 1,770 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Update Parent Window

I have a simple form with a text box in it that I'm using to show the
history of events in my program. My main form references a bunch of class
modules to execute various routines. I would like these routines to be able
update the textbox in the main form but am at a loss on how to do it.
(example below)

I'm sure this is an easy solution.....I just don't spend enough time working
in the vb.net world.

Thanks.

-----------------------------------------------------------
Example:

Main Form name - Engine.vb and has a textbox called boxHistory

Private Sub Engine_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim myCode As New CommonCode()
boxHistory="Hello"
myCode.DoSomething
End Sub
The class file is called CommonCode.vb with a routine called DoSomething

Public Sub DoSomething()

'End result would be to update boxHistory
boxHistory.text &= " World"
End Sub

Nov 20 '05 #1
2 2960
Rob,

There are many solutions to this problem here are a couple:

(1) Pass the text box to each of your methods
(2) Define a public variable in a module that references your main form
The main form could contain a method Log(ByVal message As String)
All of your class method could then call the public variable.Log
method
e.g:

Module Start
Public mLogForm As MainForm

Public Sub Main()
Dim f as New MyMainForm

mLogForm = f
f.ShowDialog

End Sub

End Module

Public Class Stuff

Public Sub DoSomething()
Start.mLogForm.Log("Hello World")
End Sub
End Class

Dan

"Rob T" <RT*********@DONTwalchemSPAM.com> wrote in message
news:Or**************@TK2MSFTNGP10.phx.gbl...
I have a simple form with a text box in it that I'm using to show the
history of events in my program. My main form references a bunch of class
modules to execute various routines. I would like these routines to be able update the textbox in the main form but am at a loss on how to do it.
(example below)

I'm sure this is an easy solution.....I just don't spend enough time working in the vb.net world.

Thanks.

-----------------------------------------------------------
Example:

Main Form name - Engine.vb and has a textbox called boxHistory

Private Sub Engine_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim myCode As New CommonCode()
boxHistory="Hello"
myCode.DoSomething
End Sub
The class file is called CommonCode.vb with a routine called DoSomething

Public Sub DoSomething()

'End result would be to update boxHistory
boxHistory.text &= " World"
End Sub


Nov 20 '05 #2
Thanks. I'm not really sure how you're cross referencing everything, but I
got something to work. I create the module with a public variable called
"log", then reference this variable from my other class modules. I have an
existin timer event running so I justtrigger off of that and make the
textbox equal to the Log variable.

.....good enough for my stupid program. ;-)

"solex" <so***@nowhere.com> wrote in message
news:uS**************@TK2MSFTNGP09.phx.gbl...
Rob,

There are many solutions to this problem here are a couple:

(1) Pass the text box to each of your methods
(2) Define a public variable in a module that references your main form
The main form could contain a method Log(ByVal message As String)
All of your class method could then call the public variable.Log
method
e.g:

Module Start
Public mLogForm As MainForm

Public Sub Main()
Dim f as New MyMainForm

mLogForm = f
f.ShowDialog

End Sub

End Module

Public Class Stuff

Public Sub DoSomething()
Start.mLogForm.Log("Hello World")
End Sub
End Class

Dan

"Rob T" <RT*********@DONTwalchemSPAM.com> wrote in message
news:Or**************@TK2MSFTNGP10.phx.gbl...
I have a simple form with a text box in it that I'm using to show the
history of events in my program. My main form references a bunch of class modules to execute various routines. I would like these routines to be

able
update the textbox in the main form but am at a loss on how to do it.
(example below)

I'm sure this is an easy solution.....I just don't spend enough time

working
in the vb.net world.

Thanks.

-----------------------------------------------------------
Example:

Main Form name - Engine.vb and has a textbox called boxHistory

Private Sub Engine_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim myCode As New CommonCode()
boxHistory="Hello"
myCode.DoSomething
End Sub
The class file is called CommonCode.vb with a routine called DoSomething

Public Sub DoSomething()

'End result would be to update boxHistory
boxHistory.text &= " World"
End Sub



Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: umashd | last post by:
Hi, I am doing a web based project for my graduation. I studied bit of java for backend processesing and javascript for the client. Here is the scenario. In the FORM, I use INPUT TYPE=text...
1
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at...
2
by: JAW | last post by:
I have posted this in a couple of the other newsgropus but have not recieved any responses. Thought I would try it here. I have a frameset that contains frames (top and bottom). In the bottopm...
9
by: Chris | last post by:
I pop up a Modal form on a web page that allows the user to update the selections of a dropdownlist via adding a new item to the db (Sql Server).The only thing is this list is on the page beneath...
3
by: yogib | last post by:
Got my main form test.aspx This opens a new window with window.open everything works. I now want to update the parent window with the following code...
5
by: PAUL | last post by:
Hello, I have 2 tables with a relationship set up in the dataset with vb ..net. I add a new record to the parent table then edit an existing child record to have the new parent ID. However when I...
7
by: shuki | last post by:
hello guys i'm newbie here so it might sound like a stupid quastion i have 4 frame - 3 on the left and one main on the right i have links in one of the small frame that changes the page on the...
6
by: paul | last post by:
HI! How do we send a variable from an Iframe page back to its parent? I have a script that calculates the iframe's window size but I need to know how to send that value back to its parent so I...
1
by: devenderraopalleni | last post by:
can any one plz throw some light on my problem : i want to know how to automatically update the parent window when closes the child window
29
Frinavale
by: Frinavale | last post by:
I have 2 FireFox (version 2) browser windows opened. One is the child of the other. When the user is finished with the child window, a method in the parent window is called to refresh a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.