| |

VerySource

 Forgot password?
 Register
Search
View: 718|Reply: 3

Ask a simple question:

[Copy link]

2

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-1-29 23:40:01
| Show all posts |Read mode
Under winform, I only know the mutual calls under this form. How to call the controls in form1 in Form2,
 For example: in form2, I write a sql statement, and I need to add the condition of datetimepicker1.text of form1. I don't know how to call it? Wait online ~~
Reply

Use magic Report

0

Threads

15

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

Post time: 2020-3-5 12:45:01
| Show all posts
1. Overload form_create, pass the form in when creating
2. Use a static class to store 2 form pointers
Reply

Use magic Report

0

Threads

110

Posts

63.00

Credits

Newbie

Rank: 1

Credits
63.00

 Japan

Post time: 2020-3-6 10:15:01
| Show all posts
If Form2 is a subform of Form1, you can pass the constructor:

Form2 frm = new Form2 (this.TextBox1.Text.Trim ());
frm.ShowDialog (this);

Form2:

private string txt;
public Form2 (string str)
{
    this.txt = str;
}
Reply

Use magic Report

2

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-3-8 13:00:01
| Show all posts
thank you all.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list