-3

I want the user name(txtusername) entered in login form to be available in other forms(say form2) too so that i can use them in cmd.parameters.addwithvalue("@last_updated_user",txtusername.text); along with other parameters (textbox values) in form2. latest cost update

Ameena
  • 187
  • 2
  • 5
  • 18
  • See this answers http://stackoverflow.com/questions/20186722/pass-a-value-from-one-form-to-another – Mahesh Feb 06 '15 at 08:56
  • What have you tried/researched? if you copy your "answer" into google there are multiple duplicates with the answer you need – Sayse Feb 06 '15 at 08:56

1 Answers1

-1
You can use static vars, which would be the easiest solution but  if you have multiple instances and you change the static varibale in just one the change will also effect all other instances. , personally I think constructors 
so

create a constuctor for the second form which accepts 2 arguments 

i.e 

FormWhatevz form2= new FormWhatevz (textBox1.Text,textBox2.Text);
" in Form1 Code or anywhere really.."

form2.Show(); 

Constructor:

public FormWhatevz(string loginUserName,string Password)
    {
        InitializeComponent();
        textbox1value.Text = loginUserName;
        textbox1value.Text=Password; 

    }

Hope this helps , this source shows multiple ways of parsing data
between forms , source : http://www.codeproject.com/Articles/14122/Passing-Data-Between-Forms