Basically I have created a program which records customer details, when they enter the details, the information needs to appear into the other form when a button is pressed, I am new to c# so detailed help would be appreciated.
Asked
Active
Viewed 821 times
-3
-
1Are you using web forms or windows forms? – Ben Van Hees Jun 25 '13 at 10:12
-
1Are you working in ASP.Net or WPF or what? – Daniel Gimenez Jun 25 '13 at 10:12
-
2Possible duplicate http://stackoverflow.com/questions/1559770/send-values-from-one-form-to-another-form-in-c-sharp-winforms-application – Satpal Jun 25 '13 at 10:14
-
I'm using windows form and i think it's ASP.net – DanB3195 Jun 25 '13 at 10:14
-
i think ..?? web or desktop ?? – Mogli Jun 25 '13 at 10:14
-
@user2519350: Windows Form on ASP.NET? What are you talking about? – Kangkan Jun 25 '13 at 10:15
-
3A good article http://www.codeproject.com/Articles/14122/Passing-Data-Between-Forms – Satpal Jun 25 '13 at 10:15
-
I'm using windows forms and im working in ASP.Net i think – DanB3195 Jun 25 '13 at 10:15
-
like i said, i'm new to all this stuff i don't even know what ASP.net or WPF is... – DanB3195 Jun 25 '13 at 10:16
-
1@user2519350 are you sure this is C#? Maybe Ruby? – Sergey Berezovskiy Jun 25 '13 at 10:16
-
I'm positive this is c#...this is part of my assignment, i'm using visual studio as the IDE if that helps.. – DanB3195 Jun 25 '13 at 10:17
-
2Does your web browser open when you try to run it? – BaconSah Jun 25 '13 at 10:19
-
It sounds like you are using either Windows forms or WPF. You don't appear to be using ASP.NET. – Colin Mackay Jun 25 '13 at 10:27
-
Could you expand your question a bit please. Is the other form on a different page? What have you tried already? What problems have you run into? The more information you give us, the better we can help you. Please take a look at ["how do I ask a good question?"](http://stackoverflow.com/help/how-to-ask) when you get time. – Doctor Jones Jun 25 '13 at 11:22
2 Answers
1
Here is an article I wrote about passing values around between Windows Forms (it includes variations depending on how the forms are related to one another) a while ago. Here it is: http://colinmackay.co.uk/2005/04/22/passing-values-between-forms-in-net/
If you are using WPF (and I can't quite tell if you are or not, but I suspect a beginners assignment would be more tending towards WinForms anyway) then the article may not be as much use as WPF does things a little differently.
I hope it helps.

Colin Mackay
- 18,736
- 7
- 61
- 88
1
If you are using windows form then you will have to set up some properties which will get and set values on the second form and then pass the values from the 1st form. This is just one of the techniques of passing values.
//Code on your form 2
private string strClass;
private int iRollNo;
..
public string StrClass
{
get { return this.strClass; }
set { this.strClass= value; }
}
public int IRollNo
{
get { return this.iRollNo; }
set { this.iRollNo= value; }
}
//code on form1
Form2 objFrom2 = new Form2();
objFrom2.strClass= "10th";
objFrom2.iRollNo= 1;
objFrom2.ShowDialog(); //show the form.

Shahid Manzoor Bhat
- 1,307
- 1
- 13
- 32