Click here to Skip to main content
14,934,103 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Hello 1- I have two forms called Form 1 and Form 3, in Form 3 I have a database called dgrid2 and a text box called txtr.text which in the text box shows the number of rows of the data grid in cellformatting the database code txtr.Text = dgrid1.Rows.Count.ToString (); I wrote and in Form 1 I have a Yax text called txthazf. I want the value of the text box of Form 3 to be displayed in the text box of Form 1. I also want the value of the text box of Form 2 to be in the text box of Form 1 when it opens.
2- How to communicate all objects and text boxes of two forms with each other. I also applied a general property. Please, along with coding, thanks.


What I have tried:

-
txtr.Text = dgrid1.Rows.Count.ToString ();
Posted
Updated 22-Mar-21 5:52am
Comments
BillWoodruff 24-Mar-21 22:30pm
   
Yax text ... what's that ?

1 solution

Exactly how depends on the "relationship" between the two forms.
Have a look at these, one of them will fit your circumstances.
The form that creates an instance of another:
C#
MyForm mf = new MyForm();
mf.Show();
Is the "parent", the other form is the "child".
(This doesn't imply any formal MDI relationship)

Transferring information between two forms, Part 1: Parent to Child[^]
Transferring information between two forms, Part 2: Child to Parent[^]
Transferring information between two forms, Part 3: Child to Child[^]
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900