Click here to Skip to main content
15,885,366 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to transfer data between two form Pin
Sandeep Mewara11-May-12 22:15
mveSandeep Mewara11-May-12 22:15 
GeneralRe: How to transfer data between two form Pin
Promance12-May-12 19:45
Promance12-May-12 19:45 
AnswerRe: How to transfer data between two form Pin
Sandeep Mewara12-May-12 20:11
mveSandeep Mewara12-May-12 20:11 
GeneralRe: How to transfer data between two form Pin
Promance13-May-12 15:04
Promance13-May-12 15:04 
AnswerRe: How to transfer data between two form Pin
DaveyM6913-May-12 6:05
professionalDaveyM6913-May-12 6:05 
GeneralRe: How to transfer data between two form Pin
Sandeep Mewara13-May-12 6:19
mveSandeep Mewara13-May-12 6:19 
GeneralRe: How to transfer data between two form Pin
Promance13-May-12 15:38
Promance13-May-12 15:38 
AnswerRe: How to transfer data between two form Pin
Bull City Rambler12-May-12 5:16
Bull City Rambler12-May-12 5:16 
An easy is with custom events. In a simple implementation, you add an event to each form (e.g., "FormDataChanged") that gets triggered when the data changes that you want to transfer. You can store that data in a static variable in program. Then pass that data to the other form whenever you like.
C#
public static Program
{

   private static object _myTransferData = new object();

   //...

   static int Main(arg, args)
   {
      MyForm1.DataChanged += new FormDataChanged;
   }

   private static void FormDataChanged(object sender, EventArgs e)
   {
      // when you instantiate form2 later on, you can use
      //_myTransferData to pass your values
      _myTransferData = MyForm1.DataStorage;
   } 

}

GeneralRe: How to transfer data between two form Pin
OriginalGriff12-May-12 5:24
mveOriginalGriff12-May-12 5:24 
GeneralRe: How to transfer data between two form Pin
Bull City Rambler12-May-12 7:08
Bull City Rambler12-May-12 7:08 
AnswerRe: How to transfer data between two form Pin
BillWoodruff12-May-12 16:48
professionalBillWoodruff12-May-12 16:48 
GeneralRe: How to transfer data between two form Pin
Promance12-May-12 19:38
Promance12-May-12 19:38 
GeneralRe: How to transfer data between two form Pin
BillWoodruff15-May-12 16:14
professionalBillWoodruff15-May-12 16:14 
GeneralRe: How to transfer data between two form Pin
Promance19-May-12 3:47
Promance19-May-12 3:47 
AnswerRe: How to transfer data between two form Pin
Apocalypse Now13-May-12 15:00
Apocalypse Now13-May-12 15:00 
GeneralRe: How to transfer data between two form Pin
Dave Kreskowiak14-May-12 2:15
mveDave Kreskowiak14-May-12 2:15 
GeneralRe: How to transfer data between two form Pin
Pete O'Hanlon14-May-12 2:56
mvePete O'Hanlon14-May-12 2:56 
QuestionCreate an object with a string. Pin
coolfetus11-May-12 17:44
coolfetus11-May-12 17:44 
AnswerRe: Create an object with a string. Pin
Luc Pattyn11-May-12 18:23
sitebuilderLuc Pattyn11-May-12 18:23 
Questionc# tutorial Pin
Shubham Vijay11-May-12 8:41
Shubham Vijay11-May-12 8:41 
AnswerRe: c# tutorial Pin
Ravi Bhavnani11-May-12 9:04
professionalRavi Bhavnani11-May-12 9:04 
QuestionDisplaying XHTML elements with namespaces in .NET WebBrowser control Pin
Orjan Westin11-May-12 5:08
professionalOrjan Westin11-May-12 5:08 
QuestionParent child relation through the designer Pin
Ronny Portier11-May-12 4:20
Ronny Portier11-May-12 4:20 
AnswerRe: Parent child relation through the designer Pin
Dave Kreskowiak11-May-12 7:25
mveDave Kreskowiak11-May-12 7:25 
AnswerRe: Parent child relation through the designer Pin
BillWoodruff12-May-12 16:54
professionalBillWoodruff12-May-12 16:54 

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.