Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > General Computer Discussion > Software > C# event problem

Reply
Thread Tools

C# event problem

 
 
mustansir mustansir is offline
Junior Member
Join Date: May 2008
Posts: 1
 
      05-15-2008
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Event syntax problem to call up the selected event of an ods msch-prv@bluewin.ch ASP .Net 1 11-05-2007 12:19 PM
problem in changing the actual event handler into our own event ashok.dhananjeyan@gmail.com Javascript 0 10-30-2006 02:32 PM
image button click event fires before click event of button Purvi T ASP .Net 0 10-19-2004 06:19 AM
PreRender Event occurs immediatley after Load event =?Utf-8?B?QWxpcmV6YSBaaWFp?= ASP .Net 1 02-09-2004 10:19 AM
Event On Form From Control Event Dave Wurtz ASP .Net 1 12-09-2003 10:37 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57