Click here to Skip to main content
15,901,035 members
Home / Discussions / C#
   

C#

 
QuestionRe: doubt Pin
Eddy Vluggen18-Apr-16 4:33
professionalEddy Vluggen18-Apr-16 4:33 
AnswerRe: doubt Pin
Patrice T18-Apr-16 5:38
mvePatrice T18-Apr-16 5:38 
QuestionRoslyn compiler Pin
V.18-Apr-16 2:27
professionalV.18-Apr-16 2:27 
AnswerRe: Roslyn compiler Pin
Richard Deeming18-Apr-16 2:42
mveRichard Deeming18-Apr-16 2:42 
QuestionInsert rows c# Pin
Bougarra17-Apr-16 23:11
Bougarra17-Apr-16 23:11 
AnswerRe: Insert rows c# Pin
Pete O'Hanlon17-Apr-16 23:55
mvePete O'Hanlon17-Apr-16 23:55 
QuestionForm disappearing Pin
Member 238990017-Apr-16 0:02
Member 238990017-Apr-16 0:02 
AnswerRe: Form disappearing Pin
OriginalGriff17-Apr-16 0:36
mveOriginalGriff17-Apr-16 0:36 
You don't tell us when it disappears, but if it's when you press a button then it's because you told it to:
C#
private void btnok_Click(object sender, System.EventArgs e)
    {
    try
        {
        bool flag = txtipaddres.Text != "" && txtportno.Text != "";
        if (!flag)
            {
            System.Windows.Forms.MessageBox.Show("Enter IP Address and Port No to Connet\n to the Node", "Node Control", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Asterisk);
            Show();
            }
        else
            {
            System.IO.TextWriter textWriter = System.IO.File.CreateText(System.Windows.Forms.Application.StartupPath + "\\IPAddress.txt");
            textWriter.WriteLine(txtportno.Text + ";" + txtipaddres.Text);
            textWriter.Close();
            DialogResult = System.Windows.Forms.DialogResult.OK;
            Close();
            }
        }
    catch (System.Exception e1)
        {
        }
    }

private void button2_Click(object sender, System.EventArgs e)
    {
    DialogResult = System.Windows.Forms.DialogResult.Cancel;
    Close();
    }
That's what Form.Close does: closes the current form.

BTW: Don't swallow your exceptions: they mean you don't find out why it failed (or that it failed in this case). Report 'em, log 'em, whatever. But empty catch blocks don't help anyone - least of all you.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

GeneralRe: Form disappearing Pin
Member 238990017-Apr-16 0:46
Member 238990017-Apr-16 0:46 
GeneralRe: Form disappearing Pin
OriginalGriff17-Apr-16 0:50
mveOriginalGriff17-Apr-16 0:50 
GeneralRe: Form disappearing Pin
Member 238990017-Apr-16 0:55
Member 238990017-Apr-16 0:55 
GeneralRe: Form disappearing Pin
OriginalGriff17-Apr-16 1:06
mveOriginalGriff17-Apr-16 1:06 
GeneralRe: Form disappearing Pin
Member 238990017-Apr-16 1:16
Member 238990017-Apr-16 1:16 
GeneralRe: Form disappearing Pin
OriginalGriff17-Apr-16 1:30
mveOriginalGriff17-Apr-16 1:30 
GeneralRe: Form disappearing Pin
Member 238990017-Apr-16 1:42
Member 238990017-Apr-16 1:42 
GeneralRe: Form disappearing Pin
OriginalGriff17-Apr-16 1:44
mveOriginalGriff17-Apr-16 1:44 
GeneralRe: Form disappearing Pin
OriginalGriff17-Apr-16 1:40
mveOriginalGriff17-Apr-16 1:40 
GeneralRe: Form disappearing Pin
Philippe Mori18-Apr-16 12:34
Philippe Mori18-Apr-16 12:34 
AnswerRe: Form disappearing Pin
ChizI19-Apr-16 7:25
ChizI19-Apr-16 7:25 
Questionusing Enums as a design-strategy ? Pin
BillWoodruff16-Apr-16 21:59
professionalBillWoodruff16-Apr-16 21:59 
AnswerRe: using Enums as a design-strategy ? Pin
Garth J Lancaster16-Apr-16 23:01
professionalGarth J Lancaster16-Apr-16 23:01 
GeneralRe: using Enums as a design-strategy ? Pin
BillWoodruff16-Apr-16 23:29
professionalBillWoodruff16-Apr-16 23:29 
AnswerRe: using Enums as a design-strategy ? Pin
John Torjo18-Apr-16 1:37
professionalJohn Torjo18-Apr-16 1:37 
GeneralRe: using Enums as a design-strategy ? Pin
BillWoodruff18-Apr-16 4:45
professionalBillWoodruff18-Apr-16 4:45 
GeneralRe: using Enums as a design-strategy ? Pin
John Torjo18-Apr-16 9:12
professionalJohn Torjo18-Apr-16 9:12 

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.