473,396 Members | 1,971 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,396 software developers and data experts.

How to send string from 'child' user control to main form

I have a form that has a label. This form also has a tab control. The tab
control has a user control pasted on its page. Under some conditions, the
user control needs to send status strings back to the main form for display.
How can this be done?
--
Richard Lewis Haggard
www.Haggard-And-Associates.com
May 3 '06 #1
3 2553
Hi,

What if the user control use an event?
The form can hook on it and do as appropiated.

Another possible escenario is that the usercontrol receive a delegate that
he will invoke with the string when he wants the status changed. the form
will create an instance of this delegate using one member method , this
method will be the one called when needed by the usecontrol.
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Richard Lewis Haggard" <HaggardAtWorldDotStdDotCom> wrote in message
news:ul**************@TK2MSFTNGP05.phx.gbl...
I have a form that has a label. This form also has a tab control. The tab
control has a user control pasted on its page. Under some conditions, the
user control needs to send status strings back to the main form for
display. How can this be done?
--
Richard Lewis Haggard
www.Haggard-And-Associates.com

May 3 '06 #2
I think I've found a way to do it:

In the main form, there is a lblStatus.
In the user controls, which the main form knows about, there is also a
m_lblStatus control but this control doesn't get created locally.
After the main form creates lblStatus (which happens after the user controls
are created), a reference to lblStatus is written to the user control's own
m_lblStatus. Thereafter, when the user controls need to write status data to
the main form, they just write it directly to their own m_lblStatus member
which is, in reality, the main form's label which displays status.

Since I come out of a C++ background rather than a VB, I don't actually like
doing things this way. I'd originally wanted to be OOP about things but
could not come up with either a message dispatching system or a delegate
that would do the trick for me. Can someone think of a better technique to
get the status string from a user control up to the main form?
--
Richard Lewis Haggard
www.Haggard-And-Associates.com
"Richard Lewis Haggard" <HaggardAtWorldDotStdDotCom> wrote in message
news:ul**************@TK2MSFTNGP05.phx.gbl...
I have a form that has a label. This form also has a tab control. The tab
control has a user control pasted on its page. Under some conditions, the
user control needs to send status strings back to the main form for
display. How can this be done?
--
Richard Lewis Haggard
www.Haggard-And-Associates.com

May 3 '06 #3
I think you just might be looking for "Delagates". Hope that helps.

MikeY

"Richard Lewis Haggard" <HaggardAtWorldDotStdDotCom> wrote in message
news:ul**************@TK2MSFTNGP05.phx.gbl...
I have a form that has a label. This form also has a tab control. The tab
control has a user control pasted on its page. Under some conditions, the
user control needs to send status strings back to the main form for
display. How can this be done?
--
Richard Lewis Haggard
www.Haggard-And-Associates.com

May 3 '06 #4

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

Similar topics

13
by: Stuart McGraw | last post by:
I haven't been able to figure this out and would appreciate some help... I have two tables, both with autonumber primary keys, and linked in a conventional master-child relationship. I've...
3
by: Satish | last post by:
Hi, I am facing problem with, sending data frm mdi child to mdi parent. I have search Dropdown in MDI form, depend on selection, or enter string(its like IE URL functionality) and click...
7
by: moondaddy | last post by:
I have a user control being used instead of a frame page. when the user clicks on a menu item I need to send the ID (integer value) of that menu as a parameter in the postback of the user control...
10
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the...
3
by: mabond | last post by:
Firstly I hope I'm in the right forum ..... if not can someone re-direct me please. I have an application with a main form properties set to mdiparent = true. Toolbar button allows user to open...
5
by: Earl | last post by:
I need to call a method on an owned child form, and am wondering if the best way of doing this is to capture the Closing event of the form that passes control back to the form where I have the...
0
by: neonspark | last post by:
I'm buidling some simple macro functionality for my app so the users can record a sequence of keyboard inputs and replay them reliably via some menu. Originally, I used: protected override bool...
0
by: emalcolm_FLA | last post by:
Hello and TIA for any help with this non profit Christmas assistance project. I have an applicant (app history) and child (child history) tables (4 total). I need to grab the next available (in...
11
by: OldBirdman | last post by:
I have a form with several bound textboxes. These are routinely updated by User. The table in RecordSource for this form currently has 8 fields not shown on this form, but which occasionally need...
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: 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?
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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,...

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.