Click here to Skip to main content
15,902,114 members
Home / Discussions / C#
   

C#

 
AnswerRe: KeyValuePair List problem? Pin
OriginalGriff18-Oct-10 22:37
mveOriginalGriff18-Oct-10 22:37 
AnswerRe: KeyValuePair List problem? Pin
johannesnestler19-Oct-10 3:27
johannesnestler19-Oct-10 3:27 
QuestionForm submit to server [modified] Pin
Ajay Kale New18-Oct-10 20:45
Ajay Kale New18-Oct-10 20:45 
AnswerRe: Form submit to server Pin
OriginalGriff18-Oct-10 22:38
mveOriginalGriff18-Oct-10 22:38 
Questionhow to get value from form 1 to form 2 Pin
ash_ng18-Oct-10 17:29
ash_ng18-Oct-10 17:29 
AnswerRe: how to get value from form 1 to form 2 Pin
JF201518-Oct-10 18:07
JF201518-Oct-10 18:07 
AnswerRe: how to get value from form 1 to form 2 Pin
Abhinav S18-Oct-10 18:27
Abhinav S18-Oct-10 18:27 
AnswerRe: how to get value from form 1 to form 2 Pin
Calla18-Oct-10 19:46
Calla18-Oct-10 19:46 
Beside the other suggestions you could also just add a constructor to your 2nd form (that you call from your first form) that takes the class of your choice as an argument.
internal class Form2 : Form
{
  internal Form2(MyClass obj) //define a constructor that takes MyClass as an argument
  {
    MessageBox.Show (obj.Name + " " + obj.Number); //use members of MyClass as you please..
  }
}

internal class MyClass
{
  internal string Name
  { get; set; }

  internal int Number
  { get; set; }
}


In Form1 you call:
MyClass myC = new MyClass();
myC.Name = "John Doe";
myC.Number = 42;

Form2 f2 = new Form2(myC);
f2.Show();

GeneralRe: how to get value from form 1 to form 2 Pin
ash_ng18-Oct-10 20:07
ash_ng18-Oct-10 20:07 
GeneralRe: how to get value from form 1 to form 2 Pin
Calla18-Oct-10 20:19
Calla18-Oct-10 20:19 
GeneralRe: how to get value from form 1 to form 2 Pin
DaveyM6919-Oct-10 0:04
professionalDaveyM6919-Oct-10 0:04 
AnswerRe: how to get value from form 1 to form 2 Pin
Varun Sareen18-Oct-10 22:26
Varun Sareen18-Oct-10 22:26 
GeneralRe: how to get value from form 1 to form 2 Pin
OriginalGriff18-Oct-10 23:44
mveOriginalGriff18-Oct-10 23:44 
AnswerRe: how to get value from form 1 to form 2 Pin
johannesnestler19-Oct-10 3:37
johannesnestler19-Oct-10 3:37 
AnswerRe: how to get value from form 1 to form 2 Pin
Jeff Connelly19-Oct-10 4:26
Jeff Connelly19-Oct-10 4:26 
QuestionWriting/show a Variable/Result into a XML File Pin
glenki18-Oct-10 12:10
glenki18-Oct-10 12:10 
AnswerRe: Writing/show a Variable/Result into a XML File Pin
Luc Pattyn18-Oct-10 13:02
sitebuilderLuc Pattyn18-Oct-10 13:02 
GeneralRe: Writing/show a Variable/Result into a XML File [modified] Pin
glenki18-Oct-10 13:17
glenki18-Oct-10 13:17 
GeneralRe: Writing/show a Variable/Result into a XML File Pin
Richard MacCutchan18-Oct-10 22:42
mveRichard MacCutchan18-Oct-10 22:42 
QuestionDialing modem Pin
Evgeni5718-Oct-10 8:45
Evgeni5718-Oct-10 8:45 
AnswerRe: Dialing modem Pin
T M Gray18-Oct-10 10:30
T M Gray18-Oct-10 10:30 
GeneralRe: Dialing modem Pin
Evgeni5718-Oct-10 10:34
Evgeni5718-Oct-10 10:34 
QuestionRe: Dialing modem Pin
monstale18-Oct-10 19:44
monstale18-Oct-10 19:44 
AnswerRe: Dialing modem Pin
Evgeni5718-Oct-10 22:04
Evgeni5718-Oct-10 22:04 
GeneralRe: Dialing modem Pin
monstale18-Oct-10 22:48
monstale18-Oct-10 22:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.