Form Navigation in ASP.net Windows application

Form Navigation in ASP.net Windows application

let we want to navigate from  Form1 to Form2 without any parameter ; So 
//Form1 button click event

Form2  f= new Form2();
f.show();//one method
//or
f.showDialog();// alternate method


Form navigation with parameters

when you want to pass some data from one form to an other then this technique would be used. In this technique we have to make a parameterised constructor of form 2 then pass values to this constructor i.e.


//In Form2

Form2(string s){

InitializeComponent();// compulsory

label1.Text=s;// set the label1 by string s

}
// Now Form1 on button click event
Form2  f =new("My name is Umar");
f.show();




By Hafiz Muhammad Umar Hayat









Comments

Popular posts from this blog

How to make heart with name in C++

Windows Volume Controller Class