Click here to Skip to main content
15,919,613 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# code Pin
Abhinav S10-Apr-12 19:39
Abhinav S10-Apr-12 19:39 
QuestionHow to make a new MDI child form maximum size? Pin
fantasy121510-Apr-12 15:42
fantasy121510-Apr-12 15:42 
AnswerRe: How to make a new MDI child form maximum size? Pin
Karthik Harve10-Apr-12 18:17
professionalKarthik Harve10-Apr-12 18:17 
GeneralRe: How to make a new MDI child form maximum size? Pin
fantasy121510-Apr-12 22:56
fantasy121510-Apr-12 22:56 
QuestionList Box Sudden Exit On Selection Pin
PDTUM10-Apr-12 13:33
PDTUM10-Apr-12 13:33 
AnswerRe: List Box Sudden Exit On Selection Pin
Richard Andrew x6410-Apr-12 14:01
professionalRichard Andrew x6410-Apr-12 14:01 
AnswerRe: List Box Sudden Exit On Selection Pin
Luc Pattyn10-Apr-12 15:35
sitebuilderLuc Pattyn10-Apr-12 15:35 
AnswerRe: List Box Sudden Exit On Selection Pin
PDTUM11-Apr-12 5:52
PDTUM11-Apr-12 5:52 
Thank you Luc (nice of you to reply to me again) and to all of you in fact for your excellent replies. All are good advice and I intent to use it all. Re: The Issue; most of the time, I usually find myself embarrassed when I finally solve some of these things. I employed the following simple one line of code in the SelectedIndexChanged event to resolve the issue:

C#
private void listBoxXxx_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listBoxXxx.Items.Count < 1)
            {
                string msg = "There are no Items in the list to select from. ";
                MessageBox.Show(msg, "Required Information Missing", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (listBoxXxx.SelectedIndex != -1)
            {
                labelXxx.Text = listBoxXxx.SelectedItem.ToString();
            }
        }


To my friend and mentor Luc...actually, I looked up my history and I usually do supply the code when the issue is code failure but not when (I don't know how) which is sometimes the case. In this case, I should have supplied the following, but it was so basic I could not understand the possible link, so please accept my apology.

C#
        //Load the Main page
        frmMain m = new frmMain(fname, title, firm, firmId, permission, theDate, userId, chal, CONNSTR);
        this.Hide();
        m.ShowDialog();
    }
}
catch (SqlException Sqlex)  //Catch Sql Errors
{
    MessageBox.Show("Error: " + Sqlex, "SQL Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}

catch (Exception ex)  //Catch All Errors
{
    MessageBox.Show("Error: " + ex, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
    return;
}


Most important...thank you all for your interest and expertise. Luc, your answer was closest to what I used and I am marking it as the correct solution. Best Regards, Pat Smile | :) Smile | :)
AnswerRe: List Box Sudden Exit On Selection Pin
BobJanova10-Apr-12 23:21
BobJanova10-Apr-12 23:21 
QuestionC# App to/from MetaTrader 4 Pin
iltallman10-Apr-12 12:28
iltallman10-Apr-12 12:28 
QuestionHow I can isolate a Keyboard in the operative system? Pin
tsw198510-Apr-12 7:49
tsw198510-Apr-12 7:49 
AnswerRe: How I can isolate a Keyboard in the operative system? Pin
Dave Kreskowiak10-Apr-12 8:11
mveDave Kreskowiak10-Apr-12 8:11 
GeneralRe: How I can isolate a Keyboard in the operative system? Pin
tsw198510-Apr-12 10:05
tsw198510-Apr-12 10:05 
GeneralRe: How I can isolate a Keyboard in the operative system? Pin
Dave Kreskowiak10-Apr-12 10:24
mveDave Kreskowiak10-Apr-12 10:24 
GeneralRe: How I can isolate a Keyboard in the operative system? Pin
tsw198510-Apr-12 10:45
tsw198510-Apr-12 10:45 
GeneralRe: How I can isolate a Keyboard in the operative system? Pin
PIEBALDconsult10-Apr-12 11:37
mvePIEBALDconsult10-Apr-12 11:37 
GeneralRe: How I can isolate a Keyboard in the operative system? Pin
Dave Kreskowiak10-Apr-12 14:21
mveDave Kreskowiak10-Apr-12 14:21 
GeneralRe: How I can isolate a Keyboard in the operative system? Pin
tsw198511-Apr-12 1:17
tsw198511-Apr-12 1:17 
AnswerRe: How I can isolate a Keyboard in the operative system? Pin
jschell10-Apr-12 8:32
jschell10-Apr-12 8:32 
AnswerRe: How I can isolate a Keyboard in the operative system? Pin
PIEBALDconsult10-Apr-12 10:40
mvePIEBALDconsult10-Apr-12 10:40 
QuestionSend SMS using GSM modem Pin
zakirox12310-Apr-12 5:50
zakirox12310-Apr-12 5:50 
AnswerRe: Send SMS using GSM modem Pin
kevinnicol10-Apr-12 6:33
kevinnicol10-Apr-12 6:33 
Questionc# calling Stored Procedures Pin
si_6910-Apr-12 5:39
si_6910-Apr-12 5:39 
AnswerRe: c# calling Stored Procedures Pin
Pete O'Hanlon10-Apr-12 5:47
mvePete O'Hanlon10-Apr-12 5:47 
AnswerRe: c# calling Stored Procedures Pin
jschell10-Apr-12 8:36
jschell10-Apr-12 8:36 

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.