473,407 Members | 2,629 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,407 software developers and data experts.

Controlling a form from within another class

I seem to be transitioning from VB6 to VB.Net very unevenly - got some
fancier things working OK but then trip over something that ought to
be simple in .Net:

It's the change in WinForm instantiation that I've clearly got a block
understanding. What I want to do is something very straightforward:

I have one main form (Form1) that is allowed to instantiate itself as
per the default mechanism. I'm then writing classes for some heavy
processing that will be instantiated in Form 1. What I need to do is
very simply to change Form1.text programmatically to reflect the state
of processing inside of the child classes, but can't get a reference
to Form1

I thought that something like

Public Class Processor

Dim F1 as New Form1

... etc

End Class

might do the trick, but just gives a StackOverflow exception on
compilation. I know this is something pretty basic but anyone able to
point out the errors of my ways please?

JGD
Nov 21 '05 #1
4 1139
Me.Text="My State"
--
OHM ( Terry Burns ) * Use the following to email me *

Dim ch() As Char = "ufssz/cvsotAhsfbuTpmvujpotXjui/OFU".ToCharArray()
For i As Int32 = 0 To ch.Length - 1
ch(i) = Convert.ToChar(Convert.ToInt16(ch(i)) - 1)
Next
Process.Start("mailto:" & New String(ch))
--
"John Dann" <ne**@prodata.co.uk> wrote in message
news:od********************************@4ax.com...
I seem to be transitioning from VB6 to VB.Net very unevenly - got some
fancier things working OK but then trip over something that ought to
be simple in .Net:

It's the change in WinForm instantiation that I've clearly got a block
understanding. What I want to do is something very straightforward:

I have one main form (Form1) that is allowed to instantiate itself as
per the default mechanism. I'm then writing classes for some heavy
processing that will be instantiated in Form 1. What I need to do is
very simply to change Form1.text programmatically to reflect the state
of processing inside of the child classes, but can't get a reference
to Form1

I thought that something like

Public Class Processor

Dim F1 as New Form1

... etc

End Class

might do the trick, but just gives a StackOverflow exception on
compilation. I know this is something pretty basic but anyone able to
point out the errors of my ways please?

JGD

Nov 21 '05 #2
On Sat, 9 Oct 2004 19:55:58 +0100, "One Handed Man \( OHM - Terry
Burns \)" <news.microsoft.com> wrote:
Me.Text="My State"


'Text is not a member of Processor'

(using Processor as the name of my example class. In other words Me
refers to the immediate containing class (ie Processor) and not to its
ultimate containing form.)

JGD
Nov 21 '05 #3
Hi,

Need to see more code to figure out whyyou are getting stack
overflow. Try this to get a reference to the form.

Public Class Processor

Dim F1 as Form1

Public Sub New(frm as Form1)

f1=frm

end sub
End Class
Ken
----------------------

"John Dann" <ne**@prodata.co.uk> wrote in message
news:od********************************@4ax.com...
I seem to be transitioning from VB6 to VB.Net very unevenly - got some
fancier things working OK but then trip over something that ought to
be simple in .Net:

It's the change in WinForm instantiation that I've clearly got a block
understanding. What I want to do is something very straightforward:

I have one main form (Form1) that is allowed to instantiate itself as
per the default mechanism. I'm then writing classes for some heavy
processing that will be instantiated in Form 1. What I need to do is
very simply to change Form1.text programmatically to reflect the state
of processing inside of the child classes, but can't get a reference
to Form1

I thought that something like

Public Class Processor

Dim F1 as New Form1

.... etc

End Class

might do the trick, but just gives a StackOverflow exception on
compilation. I know this is something pretty basic but anyone able to
point out the errors of my ways please?

JGD
Nov 21 '05 #4
Sorry, I mi-read ur post. Kens example will work

--
OHM ( Terry Burns ) * Use the following to email me *

Dim ch() As Char = "ufssz/cvsotAhsfbuTpmvujpotXjui/OFU".ToCharArray()
For i As Int32 = 0 To ch.Length - 1
ch(i) = Convert.ToChar(Convert.ToInt16(ch(i)) - 1)
Next
Process.Start("mailto:" & New String(ch))
--
"John Dann" <ne**@prodata.co.uk> wrote in message
news:ce********************************@4ax.com...
On Sat, 9 Oct 2004 19:55:58 +0100, "One Handed Man \( OHM - Terry
Burns \)" <news.microsoft.com> wrote:
Me.Text="My State"


'Text is not a member of Processor'

(using Processor as the name of my example class. In other words Me
refers to the immediate containing class (ie Processor) and not to its
ultimate containing form.)

JGD

Nov 21 '05 #5

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

Similar topics

0
by: max reason | last post by:
I added the WebBrowser component to my toolbox, then placed one on a form with other .NET components. This much seems to have worked, but I do not understand how to control the sucker from within...
0
by: HarryS | last post by:
Hi, Just wondering if someone can point me in the direction of a good tutorial. Today I was trying to come up with a way of controlling an asp:adrotator in the codebehind file, as I wanted...
9
by: jcrouse | last post by:
This is rediculous that I can't figure this out. I'm really getting frustrated with VB .NET. Everything seemed so much easier in VB5 and VB6. I'm really getting to feel conciseness about the number...
4
by: LCAdeveloper | last post by:
Help! Another newbie question I'm afraid. I have a toolbar on an MDI form, which I can control OK to produce a child form. When the child form is active, the appropriate MDI parent form toolbar...
8
by: GaryDean | last post by:
We have been noticing that questions on vs.2005/2.0 don't appear to get much in answers so I'm reposting some questions posted by some of the programmers here in our organization that never got...
2
by: Mike Baugh | last post by:
I am using visual studio 2005 to develop a form using c# I have 3 datagrids on one form. I can set the row color based on a certain value in a column. However this color applies to all 3...
0
by: DonnaDarko | last post by:
Hi again, I have a question regarding how to control one form's values from another form. I have figured out that the best spot for this control comes from the OKButton on a form called...
12
by: colt28 | last post by:
Ok so I found an ajax contact form script but i can't get the b****** to work. I made a bunch of alterations to it and it didn't work so i replaced everything with the original and it still didn't...
0
by: thersitz | last post by:
Hi, Using aspnet3.5,VStudio 2008, VB 1.) I have a set of pages, with a search text box button within a userControl that searches across our websites and is registered in a masterpage. 2)...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.