Click here to Skip to main content
15,895,084 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Dear Friends

I have two page in project Form 1 and Form 2.

I have create a function in form1 and connect that with sql server
now I want to call that function from another page form 2. can anybody help me .
Posted
Comments
Kaushikhalvadiya 8-Aug-13 6:13am    
In form2, create object of form1.

Then, by using Object.function_name syntax, you can call that method in form2..
Maciej Los 8-Aug-13 7:00am    
WPF? WinForms?

1 solution

Hello ,

You have to change Form1

C#
public partial class Form1
{

}


To

C#
public class Form1
{

}


and then you can use Form1 to create new object as Form1 frm = new Form1(); in Form2 and then

frm.FunctionName(); like this you can use.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900