windows application
-
hey can anybody tell me how to pass control values of one window form to other in windows application in c#?????????????????????/ Thanking You. Sincerely, VIRAL PATEL
Hello... You can use public variable to which you can pass value...Like suppose if you have two forms Form1 n Form2. Now you want to pass value from Form1 to Form2.....First make a public variable in Form2 then in Form1 use the following code. Form2 obj = new Form2(); obj.yourpublicvariable = "some value"; // assign value to public var of form2 // ur code ................................................ The other way could be that you can pass the value to Form2 via Constructor.like Form2 obj = new Form2("Some Value"); //For this you must write your own constructor in Form2 accepting the value u r passing. Hope this helps regards mubashir
-
hey can anybody tell me how to pass control values of one window form to other in windows application in c#?????????????????????/ Thanking You. Sincerely, VIRAL PATEL
You can read this article on passing values between forms[^]
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question." --Charles Babbage (1791-1871) My: Website | Blog
-
Hello... You can use public variable to which you can pass value...Like suppose if you have two forms Form1 n Form2. Now you want to pass value from Form1 to Form2.....First make a public variable in Form2 then in Form1 use the following code. Form2 obj = new Form2(); obj.yourpublicvariable = "some value"; // assign value to public var of form2 // ur code ................................................ The other way could be that you can pass the value to Form2 via Constructor.like Form2 obj = new Form2("Some Value"); //For this you must write your own constructor in Form2 accepting the value u r passing. Hope this helps regards mubashir
_mubashir wrote:
You can use public variable to which you can pass value
Ugghh! That is a bad idea and here's why[^]
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question." --Charles Babbage (1791-1871) My: Website | Blog
-
_mubashir wrote:
You can use public variable to which you can pass value
Ugghh! That is a bad idea and here's why[^]
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question." --Charles Babbage (1791-1871) My: Website | Blog