Click here to Skip to main content
15,884,628 members
Home / Discussions / C#
   

C#

 
AnswerRe: Color of label Pin
Luc Pattyn7-Mar-09 5:43
sitebuilderLuc Pattyn7-Mar-09 5:43 
GeneralRe: Color of label Pin
mrithula87-Mar-09 6:50
mrithula87-Mar-09 6:50 
AnswerRe: Color of label Pin
Luc Pattyn7-Mar-09 7:01
sitebuilderLuc Pattyn7-Mar-09 7:01 
GeneralRe: Color of label Pin
Expert Coming7-Mar-09 7:25
Expert Coming7-Mar-09 7:25 
GeneralRe: Color of label Pin
Colin Angus Mackay8-Mar-09 4:13
Colin Angus Mackay8-Mar-09 4:13 
AnswerRe: Color of label Pin
Luc Pattyn7-Mar-09 9:36
sitebuilderLuc Pattyn7-Mar-09 9:36 
GeneralRe: Color of label Pin
mrithula88-Mar-09 6:58
mrithula88-Mar-09 6:58 
AnswerRe: Color of label Pin
Luc Pattyn8-Mar-09 9:50
sitebuilderLuc Pattyn8-Mar-09 9:50 
Hi,

1.
AFAIK there is no ListBox event firing when something gets added to its Items, so you will have to modify the code that adds stuff to the ListBox.Items, which probably resides in an event-driven handler anyway (some kind of DataReceived handler I would hope).

2.
The code shown is wrong and ugly for several reasons:
- ListBox.SelectedItem can be null (when nothing is selected), in which case you are switching to Inactive;
- once the server is active, it probably will add more stuff to the ListBox, and everytime that a some new line is clicked, assuming it is different from "Welcome to the Server" it will again declare an inactive state. Remedy: check on the presence of something that signifies end of session.
- what happens if the "Welcome to the Server" message changes for some reason, say extra spaces, carriage returns, etc? Checking for an exact match isn't probably not very wise, I would at least doif (kl.ToLower().Contains("welcome to the server"))...

Smile | :)
Luc Pattyn [Forum Guidelines] [My Articles]

- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets


modified on Sunday, June 12, 2011 9:12 AM

QuestionInstalling application that queries FoxPro tables Pin
dptalt7-Mar-09 5:12
dptalt7-Mar-09 5:12 
QuestionHow to get the .exe file run after coying from a location to another location Pin
tyrone01097-Mar-09 2:52
tyrone01097-Mar-09 2:52 
AnswerRe: How to get the .exe file run after coying from a location to another location Pin
DaveyM697-Mar-09 3:08
professionalDaveyM697-Mar-09 3:08 
AnswerRe: How to get the .exe file run after coying from a location to another location Pin
sohighthesky8-Mar-09 5:08
sohighthesky8-Mar-09 5:08 
QuestionGUI Problem Pin
anishkannan7-Mar-09 2:13
anishkannan7-Mar-09 2:13 
AnswerRe: GUI Problem Pin
DaveyM697-Mar-09 2:28
professionalDaveyM697-Mar-09 2:28 
AnswerRe: GUI Problem Pin
ABitSmart7-Mar-09 3:28
ABitSmart7-Mar-09 3:28 
AnswerRe: GUI Problem Pin
Natza Mitzi8-Mar-09 9:58
Natza Mitzi8-Mar-09 9:58 
QuestionMultiple Record Insert Pin
shafiullah1237-Mar-09 1:19
shafiullah1237-Mar-09 1:19 
AnswerRe: Multiple Record Insert Pin
fly9047-Mar-09 8:23
fly9047-Mar-09 8:23 
QuestionChanging size of Array at Runtime Pin
nagendrathecoder7-Mar-09 1:11
nagendrathecoder7-Mar-09 1:11 
AnswerRe: Changing size of Array at Runtime Pin
Aghosh Babu7-Mar-09 1:19
Aghosh Babu7-Mar-09 1:19 
AnswerRe: Changing size of Array at Runtime Pin
nagendrathecoder7-Mar-09 1:24
nagendrathecoder7-Mar-09 1:24 
GeneralRe: Changing size of Array at Runtime Pin
Aghosh Babu7-Mar-09 1:30
Aghosh Babu7-Mar-09 1:30 
GeneralRe: Changing size of Array at Runtime Pin
nagendrathecoder7-Mar-09 1:34
nagendrathecoder7-Mar-09 1:34 
AnswerRe: Changing size of Array at Runtime Pin
Luc Pattyn7-Mar-09 1:42
sitebuilderLuc Pattyn7-Mar-09 1:42 
GeneralRe: Changing size of Array at Runtime Pin
harold aptroot7-Mar-09 3:21
harold aptroot7-Mar-09 3:21 

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.