Click here to Skip to main content
15,886,110 members
Home / Discussions / C#
   

C#

 
AnswerRe: Setup and File association Pin
GenJerDan20-Jan-11 3:40
GenJerDan20-Jan-11 3:40 
GeneralRe: Setup and File association Pin
Eduard Keilholz20-Jan-11 21:00
Eduard Keilholz20-Jan-11 21:00 
AnswerRe: Setup and File association Pin
J a a n s20-Jan-11 16:57
professionalJ a a n s20-Jan-11 16:57 
GeneralRe: Setup and File association Pin
Eduard Keilholz20-Jan-11 21:02
Eduard Keilholz20-Jan-11 21:02 
QuestionModal window Pin
fififlowertot19-Jan-11 23:26
fififlowertot19-Jan-11 23:26 
AnswerRe: Modal window Pin
DaveyM6920-Jan-11 0:55
professionalDaveyM6920-Jan-11 0:55 
AnswerRe: Modal window Pin
#realJSOP20-Jan-11 4:44
mve#realJSOP20-Jan-11 4:44 
AnswerRe: Modal window Pin
Paladin200020-Jan-11 7:50
Paladin200020-Jan-11 7:50 
As an alternative, you could create a static class. Just make a form with a textbox, and a button with "DialogResult" set to "OK", and a static wrapper...

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

    public string StringValue
    {
        get { return textBox1.Text; }
        set { textBox1.Text = value; }
    }
}

public static class InputBox
{
    private static Input _input = new Input();

    public static DialogResult ShowDialog(string caption, ref string value)
    {
        _input.Text = caption;
        _input.StringValue = value; //Populates the textbox with the provided value as a default

        if (_input.ShowDialog() == DialogResult.OK)
        {
            value = _input.StringValue;
            return DialogResult.OK;
        }
        return DialogResult.Cancel;
    }
}


Then use it like this...

private void button1_Click(object sender, EventArgs e)
{
    string x = "Some default text";
    if (InputBox.ShowDialog("Test", ref x) == DialogResult.OK)  MessageBox.Show(x);
}

GeneralRe: Modal window Pin
OriginalGriff20-Jan-11 8:29
mveOriginalGriff20-Jan-11 8:29 
GeneralRe: Modal window Pin
Paladin200020-Jan-11 8:41
Paladin200020-Jan-11 8:41 
GeneralRe: Modal window Pin
OriginalGriff21-Jan-11 1:30
mveOriginalGriff21-Jan-11 1:30 
GeneralRe: Modal window Pin
Paladin200021-Jan-11 3:18
Paladin200021-Jan-11 3:18 
GeneralRe: Modal window Pin
OriginalGriff21-Jan-11 5:12
mveOriginalGriff21-Jan-11 5:12 
AnswerRe: Modal window Pin
RaviRanjanKr23-Jan-11 17:50
professionalRaviRanjanKr23-Jan-11 17:50 
QuestionIncrease Execution time for Sp in webconfig for time out problem Pin
Mugdha_Aditya19-Jan-11 23:06
Mugdha_Aditya19-Jan-11 23:06 
AnswerRe: Increase Execution time for Sp in webconfig for time out problem Pin
TweakBird19-Jan-11 23:52
TweakBird19-Jan-11 23:52 
GeneralRe: Increase Execution time for Sp in webconfig for time out problem Pin
Mugdha_Aditya19-Jan-11 23:56
Mugdha_Aditya19-Jan-11 23:56 
GeneralRe: Increase Execution time for Sp in webconfig for time out problem Pin
TweakBird20-Jan-11 0:57
TweakBird20-Jan-11 0:57 
GeneralRe: Increase Execution time for Sp in webconfig for time out problem Pin
Mugdha_Aditya20-Jan-11 1:40
Mugdha_Aditya20-Jan-11 1:40 
AnswerRe: Increase Execution time for Sp in webconfig for time out problem Pin
#realJSOP20-Jan-11 2:25
mve#realJSOP20-Jan-11 2:25 
GeneralRe: Increase Execution time for Sp in webconfig for time out problem Pin
Mugdha_Aditya20-Jan-11 2:52
Mugdha_Aditya20-Jan-11 2:52 
GeneralRe: Increase Execution time for Sp in webconfig for time out problem Pin
Dave Kreskowiak20-Jan-11 4:49
mveDave Kreskowiak20-Jan-11 4:49 
AnswerRe: Increase Execution time for Sp in webconfig for time out problem Pin
Dave Kreskowiak20-Jan-11 4:48
mveDave Kreskowiak20-Jan-11 4:48 
AnswerRe: Increase Execution time for Sp in webconfig for time out problem Pin
Mahendra Vishwakarma23-Jan-11 18:48
Mahendra Vishwakarma23-Jan-11 18:48 
QuestionMake ,windows application contents available and save online Pin
varun.g19-Jan-11 19:45
varun.g19-Jan-11 19:45 

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.