473,396 Members | 2,013 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.

Pass a value from child Win form back to textbox of parent Win Form

I have Form1 launches Form2. On Form2, user will enter input (a string).

When I click OK to close Form2, I need to have that string value populated TextBox1 on Form1 (the parent form).

I only find clues on doing the other way (passing from parent to child), which I have already been doing fine. But don't know how to let child form recognize (already opend/launched) parent form to access control there.

Thank you!
Dec 21 '07 #1
3 3344
Killer42
8,435 Expert 8TB
What version of VB are you using?

And just out of curiosity, how are you passing info from parent to child?

(Have you considered the use of global variables?)
Dec 21 '07 #2
Visual Studio 2005.

Here is what I used on parent form to launch the child form:

'==================
Dim UserDefinedForm As New diagUserDefined
UserDefinedForm.Show()
UserDefinedForm.txSelected.Text = "Passed from Parent"
'==========================

It works fine and on diagUserDefined win form, the string shows up. But when I need to get a string on this form, how should I pass it back onto a text field of the parent?

Thank you!
Dec 21 '07 #3
Killer42
8,435 Expert 8TB
Why can't you just access the controls on the parent or child form in the same way? I konw you can in VB6, but not sure of the syntax in later versions.

Note that one thing which may cause you problems is if you're trying to access controls on a form after closing the form. I don't think it's possible. At a guess, VB would load the form again (but not show it), and the controls would contain whatever defaults they start with.
Dec 21 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Dayne | last post by:
Can a Parent thread catch a event send by a child thread? Dayne
8
by: darrel | last post by:
I'm still trying to fully understand how best to pass variables between pages/usercontrols/each other. On a current site I've done, I've had one userControl do the logic and set the variable,...
3
by: Chris | last post by:
Before I started to create table, etc to track unique form field record number assigments I thought I'd check to see if there is now a better way to do this in .NET. I have a parent form (table)...
3
by: Hei | last post by:
Hi All, i using .showdialog to show a child form for user input some data, and i wand to pass back these data to the parent form. how can i achieve this? thx. Hei.
6
by: kath | last post by:
hi everyone......... I have a task, I have fragmented the task into subtask. I have planned to create a class to each subclass and one parent class to handle the sub tasks. Each subclass are...
14
by: =?Utf-8?B?Umljaw==?= | last post by:
I have seen examples of passing data from FormB to FormA (Parent To Child) but I need an example of passind data from FormA to FormB. My main form is FormA; I will enter some data in textboxes and...
5
by: Rob | last post by:
I have a control (Button) on a Parent form which opens a Windows form... all I want to do is pass a value from the child form back to the parent... it should be so simple... i.e....
12
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms....
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
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?
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...

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.