Click here to Skip to main content
15,887,676 members
Home / Discussions / C#
   

C#

 
GeneralRe: Which Timer to use? Pin
Ian Shlasko4-Feb-11 10:37
Ian Shlasko4-Feb-11 10:37 
AnswerRe: Which Timer to use? Pin
PIEBALDconsult4-Feb-11 4:41
mvePIEBALDconsult4-Feb-11 4:41 
AnswerRe: No demons to be seen Pin
Luc Pattyn4-Feb-11 6:04
sitebuilderLuc Pattyn4-Feb-11 6:04 
Questionshow form Pin
Elham M4-Feb-11 3:09
Elham M4-Feb-11 3:09 
AnswerRe: show form Pin
Pete O'Hanlon4-Feb-11 3:23
mvePete O'Hanlon4-Feb-11 3:23 
AnswerRe: show form Pin
Paladin20004-Feb-11 4:03
Paladin20004-Feb-11 4:03 
GeneralRe: show form Pin
Elham M5-Feb-11 5:46
Elham M5-Feb-11 5:46 
GeneralRe: show form Pin
Paladin20007-Feb-11 3:37
Paladin20007-Feb-11 3:37 
You need to make an accessor to expose the items you need from the form. Here is an example: I created a project with two forms. Form1 (parent/main) contains a textbox and a button. Form2 (dialog) has a textbox and two buttons (OK and Cancel). In the properties of the buttons, I set the "DialogResult" to "OK" and "Cancel" respectively, then in Form2's properties, set the AcceptButton to the OK button, and the CancelButton to the Cancel button. From there, the code is simple:

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    private void button1_Click(object sender, EventArgs e)
    {
        Form2 frm = new Form2();
        if (frm.ShowDialog() == DialogResult.Cancel) return;  //Cancel was chosen, so do nothing else
        textBox1.Text = frm.Value;
    }
}


public partial class Form2 : Form
{
    public Form2()
    {
        InitializeComponent();
    }

    /// <summary>
    /// Makes the value of the textbox accessible.
    /// </summary>
    public string Value
    {
        get { return textBox1.Text; }
    }
}

GeneralRe: show form Pin
Elham M7-Feb-11 6:21
Elham M7-Feb-11 6:21 
AnswerRe: show form Pin
freshonlineMax4-Feb-11 4:04
freshonlineMax4-Feb-11 4:04 
GeneralRe: show form Pin
Pete O'Hanlon4-Feb-11 4:16
mvePete O'Hanlon4-Feb-11 4:16 
AnswerRe: show form Pin
_Erik_4-Feb-11 5:32
_Erik_4-Feb-11 5:32 
AnswerRe: show form Pin
DaveyM694-Feb-11 6:23
professionalDaveyM694-Feb-11 6:23 
AnswerRe: show form Pin
Anubhava Dimri4-Feb-11 21:34
Anubhava Dimri4-Feb-11 21:34 
Questionchange the shape of the tab header in tab control Pin
NarVish4-Feb-11 1:39
NarVish4-Feb-11 1:39 
AnswerRe: change the shape of the tab header in tab control PinPopular
Luc Pattyn4-Feb-11 2:06
sitebuilderLuc Pattyn4-Feb-11 2:06 
GeneralRe: change the shape of the tab header in tab control Pin
NarVish6-Feb-11 17:41
NarVish6-Feb-11 17:41 
GeneralRe: change the shape of the tab header in tab control Pin
Luc Pattyn6-Feb-11 21:15
sitebuilderLuc Pattyn6-Feb-11 21:15 
Questionc# Client Server Application Pin
LAPEC4-Feb-11 1:35
LAPEC4-Feb-11 1:35 
AnswerRe: c# Client Server Application Pin
RobCroll4-Feb-11 1:49
RobCroll4-Feb-11 1:49 
AnswerRe: c# Client Server Application Pin
phil.o4-Feb-11 2:21
professionalphil.o4-Feb-11 2:21 
AnswerRe: c# Client Server Application Pin
_Erik_4-Feb-11 5:39
_Erik_4-Feb-11 5:39 
QuestionInput details in cmd via Process Pin
All Time Programming4-Feb-11 0:10
All Time Programming4-Feb-11 0:10 
AnswerRe: Input details in cmd via Process Pin
Xmen Real 4-Feb-11 1:23
professional Xmen Real 4-Feb-11 1:23 
GeneralRe: Input details in cmd via Process Pin
All Time Programming4-Feb-11 1:42
All Time Programming4-Feb-11 1:42 

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.