Click here to Skip to main content
15,893,668 members
Home / Discussions / C#
   

C#

 
AnswerRe: Adding Controls of user control ot the parent Form. Pin
fjdiewornncalwe13-Oct-10 1:30
professionalfjdiewornncalwe13-Oct-10 1:30 
Questiondata transfers between two forms Pin
Erdinc2712-Oct-10 22:26
Erdinc2712-Oct-10 22:26 
AnswerRe: data transfers between two forms Pin
Blue_Boy12-Oct-10 22:39
Blue_Boy12-Oct-10 22:39 
GeneralRe: data transfers between two forms PinPopular
OriginalGriff12-Oct-10 22:44
mveOriginalGriff12-Oct-10 22:44 
GeneralRe: data transfers between two forms Pin
Blue_Boy12-Oct-10 22:48
Blue_Boy12-Oct-10 22:48 
AnswerRe: data transfers between two forms Pin
OriginalGriff12-Oct-10 22:41
mveOriginalGriff12-Oct-10 22:41 
GeneralRe: data transfers between two forms Pin
Erdinc2712-Oct-10 22:46
Erdinc2712-Oct-10 22:46 
GeneralRe: data transfers between two forms PinPopular
OriginalGriff12-Oct-10 23:00
mveOriginalGriff12-Oct-10 23:00 
Use the existing instance.

private void btnRehber_Click(object sender, EventArgs e)
   {
   Form2 rhbForm = new Form2();
   rhbForm.txtYetkili_isim.Text = txtYetkili_adi.Text;
   rhbForm.ShowDialog();
   txtGsm1.Text = rhbForm.txtGsm1.Text;
   txtGsm2.Text = rhbForm.txtGsm2.Text;
   txtNumara.Text = rhbForm.txtNumara.Text;
   }

Except that won't work as it is because the TextBoxes are (correctly) private to Form2. So instead add them as properties to Form2:
public class Form2 : Form
   {
   ...
   public string Gsm1
      {
      get { return txtGsm1.Text; }
      } 
   ...
   }
Reapeat for Gsm2 and Numara.
Then access Gsm1 in Form1:
private void btnRehber_Click(object sender, EventArgs e)
   {
   Form2 rhbForm = new Form2();
   rhbForm.txtYetkili_isim.Text = txtYetkili_adi.Text;
   rhbForm.ShowDialog();
   txtGsm1.Text = rhbForm.Gsm1;
   txtGsm2.Text = rhbForm.Gsm2;
   txtNumara.Text = rhbForm.Numara;
   }

It would also be a good idea to make "yetkili" a property as well, this time with a setter as well as a getter.
The idea is that Form1 does not need to know how Form2 works - just that it can get Gsm data for it.
You can then change the internals of Form2 as much as you like, without having to alter Form1
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.

GeneralRe: data transfers between two forms Pin
Erdinc2712-Oct-10 23:23
Erdinc2712-Oct-10 23:23 
AnswerRe: data transfers between two forms PinPopular
Pete O'Hanlon12-Oct-10 23:06
mvePete O'Hanlon12-Oct-10 23:06 
GeneralRe: data transfers between two forms Pin
Erdinc2712-Oct-10 23:24
Erdinc2712-Oct-10 23:24 
GeneralRe: data transfers between two forms Pin
Pete O'Hanlon12-Oct-10 23:29
mvePete O'Hanlon12-Oct-10 23:29 
GeneralRe: data transfers between two forms Pin
fjdiewornncalwe13-Oct-10 1:35
professionalfjdiewornncalwe13-Oct-10 1:35 
GeneralRe: data transfers between two forms Pin
Jason Henderson14-Oct-10 3:41
Jason Henderson14-Oct-10 3:41 
AnswerRe: data transfers between two forms Pin
Ashutosh kumar Tripathi17-Oct-10 19:56
Ashutosh kumar Tripathi17-Oct-10 19:56 
Questionproblem with AL.exe created DLL Pin
prasadbuddhika12-Oct-10 18:13
prasadbuddhika12-Oct-10 18:13 
AnswerRe: problem with AL.exe created DLL Pin
fjdiewornncalwe13-Oct-10 2:37
professionalfjdiewornncalwe13-Oct-10 2:37 
QuestionSpace as string in user settings file Pin
cbutle3@netzero.com12-Oct-10 5:24
cbutle3@netzero.com12-Oct-10 5:24 
AnswerRe: Space as string in user settings file Pin
#realJSOP12-Oct-10 8:07
mve#realJSOP12-Oct-10 8:07 
AnswerRe: Space as string in user settings file Pin
kevinnicol12-Oct-10 8:25
kevinnicol12-Oct-10 8:25 
GeneralRe: Space as string in user settings file Pin
cbutle3@netzero.com12-Oct-10 9:01
cbutle3@netzero.com12-Oct-10 9:01 
GeneralRe: Space as string in user settings file Pin
Ian Shlasko12-Oct-10 9:33
Ian Shlasko12-Oct-10 9:33 
AnswerRe: Space as string in user settings file [modified] Pin
PIEBALDconsult12-Oct-10 17:09
mvePIEBALDconsult12-Oct-10 17:09 
QuestionDataGridView Search [modified] Pin
boreland12-Oct-10 3:55
boreland12-Oct-10 3:55 
AnswerRe: DataGridView Search Pin
Luc Pattyn12-Oct-10 4:14
sitebuilderLuc Pattyn12-Oct-10 4:14 

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.