C# event problem

Discussion in 'Software' started by mustansir, May 15, 2008.

  1. mustansir

    mustansir

    Joined:
    May 15, 2008
    Messages:
    1
    The b2_click method determines the values in comboBox1.
    What I want to do is if no item is selected by the user from the comboBox1 then prompt user and then continue with the rest of the code if an item is selected in the comboBox1. I am able to produce a MessageBox saying "Please select..." but then how do I continue if an item is selected without clearing all entries in the form?

    Here's the code:

    public void b2_click(object sender, EventArgs e)
    {
    string logName = comboBox1.SelectedItem.ToString();

    string record = listBox2.Text;
    int eventID = Convert.ToInt32(record.Substring(record.IndexOf(",")).TrimStart(",".ToCharArray()));
    string eventSource = getEventSource(record);
    EventLogEntryType eventType = (EventLogEntryType)this.listBox1.SelectedItem;
    string server = textBox1.Text;

    EventLog elog = new EventLog(logName, server, eventSource);
    elog.WriteEntry("This is a test Message", eventType, eventID);
    }


    Thank you,
    Mustan
     
    mustansir, May 15, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. orion30

    Problem onClick event on Firefox

    orion30, Nov 7, 2004, in forum: Firefox
    Replies:
    0
    Views:
    2,726
    orion30
    Nov 7, 2004
  2. Jack

    Outlook "All Day Event" Problem

    Jack, Aug 22, 2004, in forum: Computer Support
    Replies:
    0
    Views:
    1,801
  3. Ted Jones
    Replies:
    1
    Views:
    3,273
    old jon
    Aug 29, 2005
  4. Jack
    Replies:
    1
    Views:
    551
    voipguy
    Feb 22, 2005
  5. =?Utf-8?B?Q2FybG9z?=

    Event ID 7026 error in event viewer

    =?Utf-8?B?Q2FybG9z?=, Apr 25, 2007, in forum: Windows 64bit
    Replies:
    6
    Views:
    13,568
    =?Utf-8?B?Q2FybG9z?=
    Apr 27, 2007
Loading...

Share This Page