Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

closed closed closed closed

closed closed closed closed
Make some public properties in form1, then access them from the instance in form2.

In form2:
Code
form1 f1 = new form1();
f1.ShowDialog();

DoStuff(f1.Username, f1.Password);
Lotta blood to let, peace to make, give a fuk about a check
Form2_Load
Code
Textbox1.Text == Form1.Textbox1.Text
Third way is to accept them as args in your form's constructor and keep them private if you only need to pass and not constantly communicate between.
(Nov 17, 2015 06:14 PM)ℓιℓ υzι νєят Wrote:  I need help with somthing
So, in my form1 I got my login and I wanna get the username in the first textbox over to my form2 after logging in. How do I make it so I can get the username in a php script in the form2.

It's just the same in ur previous question. The answer is also the same
(Nov 17, 2015 06:14 PM)ℓιℓ υzι νєят Wrote:  So, in my form1 I got my login and I wanna get the username in the first textbox over to my form2 after logging in.

You can make constructor in Form2, and set values from textboxes to properties:
Code
private string login;
private string password

public void Form2(string login, string password){
  this.login = login;
  this.password = password;
}

And calling from Form1:
Code
Form2 mainForm = Form2(textBox1.Text, textBox2.Text);
this.Hide();
mainForm.Show();


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by Shad~Apr 26, 2009 09:05 PM 5 232 Apr 26, 2009 09:05 PM
Last Post: Jettboi93
[.NET] by Shad~Apr 10, 2009 06:35 AM 12 276 Apr 10, 2009 06:35 AM
Last Post: Jyeran