I need Help passing data back and forth between Windows forms
-
Hi I am trying to pass data back and forth windows forms but I am having trouble. What I am trying to do is this: I have a mainForm that has 2 textboxes called plainText and ChiperText. This main form also has a menu bar of different algo to choose from(for instance shift Chiper). When shift chiper is clicke id launched a new form(shiftchiper.cs). It has some options and it also have a toolbar with Encrypt and decrypt. When encrypt is hit I want to take the data from mainForm PlainText textbox and encrypt it. Once encrypted send it back to the mainForms chiperText box. If they hit decrypt it's the same thing just reversed. By using this tutorial( I used the property way) http://www.codeproject.com/KB/cs/pass\_data\_between\_forms.aspx I been able to send the PlainText data to the shiftChiper form and encrypt it. What I can't do is send the new encrypted data back to the ChiperText textbox in the mainForm. So anyone know how to do this? I simple example would be nice. It can be just 2 textboxes on one form and a button. when the button is clicked a form2 is made and it sends over one of the textboxes. One form2 it can have a button when clicked it sends the data that was sent back to form1. I am doing it in C# by the way.
-
Hi I am trying to pass data back and forth windows forms but I am having trouble. What I am trying to do is this: I have a mainForm that has 2 textboxes called plainText and ChiperText. This main form also has a menu bar of different algo to choose from(for instance shift Chiper). When shift chiper is clicke id launched a new form(shiftchiper.cs). It has some options and it also have a toolbar with Encrypt and decrypt. When encrypt is hit I want to take the data from mainForm PlainText textbox and encrypt it. Once encrypted send it back to the mainForms chiperText box. If they hit decrypt it's the same thing just reversed. By using this tutorial( I used the property way) http://www.codeproject.com/KB/cs/pass\_data\_between\_forms.aspx I been able to send the PlainText data to the shiftChiper form and encrypt it. What I can't do is send the new encrypted data back to the ChiperText textbox in the mainForm. So anyone know how to do this? I simple example would be nice. It can be just 2 textboxes on one form and a button. when the button is clicked a form2 is made and it sends over one of the textboxes. One form2 it can have a button when clicked it sends the data that was sent back to form1. I am doing it in C# by the way.
I think I know what you're talking about. let me see if I can help. Anything in public access space on the popup can be accessed by the main form from wherever the instance of the popup is. For example. on my main form named form1 I have a button that opens a popup named form2. in the button click event on form1's button I'd have something to the effect of PopupFormTypenameGoesHere form2 = new PopupFormTypenameGoesHere( params to send et all) form2.ShowDialogue(); Text = form2.someInfo; and in form2's close event I'd have someInfo = "hello world"; // or whatever This would cause form1's title (ie it's Text property) to be set to "hello world" after the popup had closed (or whatever someInfo was set to in that form) I hope that helps. One thing you should be careful with is the usage of Show() and ShowDialogue() - they are NOT interchangeable.
-Gatsby
-
Hi I am trying to pass data back and forth windows forms but I am having trouble. What I am trying to do is this: I have a mainForm that has 2 textboxes called plainText and ChiperText. This main form also has a menu bar of different algo to choose from(for instance shift Chiper). When shift chiper is clicke id launched a new form(shiftchiper.cs). It has some options and it also have a toolbar with Encrypt and decrypt. When encrypt is hit I want to take the data from mainForm PlainText textbox and encrypt it. Once encrypted send it back to the mainForms chiperText box. If they hit decrypt it's the same thing just reversed. By using this tutorial( I used the property way) http://www.codeproject.com/KB/cs/pass\_data\_between\_forms.aspx I been able to send the PlainText data to the shiftChiper form and encrypt it. What I can't do is send the new encrypted data back to the ChiperText textbox in the mainForm. So anyone know how to do this? I simple example would be nice. It can be just 2 textboxes on one form and a button. when the button is clicked a form2 is made and it sends over one of the textboxes. One form2 it can have a button when clicked it sends the data that was sent back to form1. I am doing it in C# by the way.
do you need to use 2 forms? is there a critical reason? i don´t see it. i use (1) parent form/child form method or (2) the form + userforms (loaded in form) method but i don´t see how you can get it to work, i assume you did the same in both forms. i think it´s because the first owes the second. Are you using delegates? check articles here on those methods, you won´t get errors :( and look nicer
nelsonpaixao@yahoo.com.br trying to help & get help
-
Hi I am trying to pass data back and forth windows forms but I am having trouble. What I am trying to do is this: I have a mainForm that has 2 textboxes called plainText and ChiperText. This main form also has a menu bar of different algo to choose from(for instance shift Chiper). When shift chiper is clicke id launched a new form(shiftchiper.cs). It has some options and it also have a toolbar with Encrypt and decrypt. When encrypt is hit I want to take the data from mainForm PlainText textbox and encrypt it. Once encrypted send it back to the mainForms chiperText box. If they hit decrypt it's the same thing just reversed. By using this tutorial( I used the property way) http://www.codeproject.com/KB/cs/pass\_data\_between\_forms.aspx I been able to send the PlainText data to the shiftChiper form and encrypt it. What I can't do is send the new encrypted data back to the ChiperText textbox in the mainForm. So anyone know how to do this? I simple example would be nice. It can be just 2 textboxes on one form and a button. when the button is clicked a form2 is made and it sends over one of the textboxes. One form2 it can have a button when clicked it sends the data that was sent back to form1. I am doing it in C# by the way.
Envents and/or delegates are the answer. I posted a delegate sample here[^] previously.
Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Expect everything to be hard and then enjoy the things that come easy. (code-frog)