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
|