2015-02-06 2 views
-3

로그인 양식에 입력 한 사용자 이름 (txtusername)을 다른 양식 (form2)에서도 사용할 수 있도록 cmd.parameters에서 사용할 수있게하고 싶습니다. .addwithvalue ("@ last_updated_user", txtusername.text); form2의 다른 매개 변수 (텍스트 상자 값)와 함께 최신 비용 업데이트다른 양식에서 form1의 텍스트 상자에 입력 한 값을 사용하는 방법

+0

이 당신이 연구/시도 무엇 http://stackoverflow.com/questions/20186722/pass-a-value-from-one-form-to-another –

+0

대답을 참조하십시오? Google에 '답변'을 복사하면 필요한 답변이 여러 번 중복됩니다. – Sayse

답변

-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  
관련 문제