I want display username in MDIParent form after login. Who can teach me and give coding to me. Hope every expert help me.

Recommended Answers

All 8 Replies

Did you try first you self then if you get any problem then post your problem with you code, I am sure one here kind enough to help you.

Did you try first you self then if you get any problem then post your problem with you code, I am sure one here kind enough to help you.

Actually, I think is from the login form, when the user click login button will bring username textbox data to MDIParent form and display in label. but i search internet not get code.

1.Did you know how to create login form
2.How to connect database
3.how to create MDI form
4.How to send data from one form to another form

1.Did you know how to create login form
2.How to connect database
3.how to create MDI form
4.How to send data from one form to another form

1,2,3 i already know. 4 I'm already try. but it only can take text already fix in textbox only. so when use key in textbox, it will not bring it to next page.

This is a example which demonstrate how to change text of label1 on form2 from form1

Form2 f = new Form2();
f.label1.Text = textBox1.Text;
this.Hide();
f.Show();

before writing this code you to change label1 from private to public to do that
1. first click on "show all files" on solution explorer
2.Open code window of form2.designer.cs and you find

private  System.Windows.Forms.Label label1;

to

public  System.Windows.Forms.Label label1;

similarly you can able to pass any variable to other form but variable must declare as public to get access

I hope it will help you

This is a example which demonstrate how to change text of label1 on form2 from form1

Form2 f = new Form2();
f.label1.Text = textBox1.Text;
this.Hide();
f.Show();

before writing this code you to change label1 from private to public to do that
1. first click on "show all files" on solution explorer
2.Open code window of form2.designer.cs and you find

private  System.Windows.Forms.Label label1;

to

public  System.Windows.Forms.Label label1;

similarly you can able to pass any variable to other form but variable must declare as public to get access

I hope it will help you

Thank You. It's work. you help me a lot. Thank You very much

Please marked this thread solve

super thank you this solved my lot of problems

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.