Click here to Skip to main content
15,922,015 members
Home / Discussions / C#
   

C#

 
AnswerRe: NotifyIcon text? Pin
Eric Gunnerson (msft)23-Jul-02 8:34
Eric Gunnerson (msft)23-Jul-02 8:34 
GeneralRe: NotifyIcon text? Pin
sasdav24-Jul-02 2:38
sasdav24-Jul-02 2:38 
GeneralRe: NotifyIcon text? Pin
Eric Gunnerson (msft)24-Jul-02 5:28
Eric Gunnerson (msft)24-Jul-02 5:28 
GeneralRe: NotifyIcon text? Pin
sasdav24-Jul-02 10:29
sasdav24-Jul-02 10:29 
GeneralRe: NotifyIcon text? Pin
Eric Gunnerson (msft)24-Jul-02 10:57
Eric Gunnerson (msft)24-Jul-02 10:57 
GeneralRe: NotifyIcon text? Pin
sasdav25-Jul-02 2:32
sasdav25-Jul-02 2:32 
QuestionCorrect way to try-catch in foreach loop? Pin
leppie22-Jul-02 22:15
leppie22-Jul-02 22:15 
AnswerRe: Correct way to try-catch in foreach loop? Pin
James T. Johnson22-Jul-02 23:08
James T. Johnson22-Jul-02 23:08 
In the above code snippet it appears that you are wary about 'anArrayList' not containing classes that are or inherit from MyClass. Unfortunately the only way to get it to continue through the loop is to write the foreach code yourself.

IEnumerator ie = anArrayList.GetEnumerator();
while(ie.MoveNext())
{
  MyClass myclass = ie.Current as MyClass;
  if( myclass != null )
  {
    DoStuff();
  }
  else
  {
    // the Current element is not a MyClass type.
  }
}
A bit uglier, but it allows you to avoid an exception and you can continue processing the loop.

James
"Java is free - and worth every penny." - Christian Graus
GeneralRe: Correct way to try-catch in foreach loop? Pin
leppie23-Jul-02 0:06
leppie23-Jul-02 0:06 
GeneralRe: Correct way to try-catch in foreach loop? Pin
James T. Johnson23-Jul-02 0:27
James T. Johnson23-Jul-02 0:27 
GeneralRe: Correct way to try-catch in foreach loop? Pin
leppie23-Jul-02 0:45
leppie23-Jul-02 0:45 
GeneralRe: Correct way to try-catch in foreach loop? Pin
James T. Johnson23-Jul-02 1:24
James T. Johnson23-Jul-02 1:24 
GeneralRe: Correct way to try-catch in foreach loop? Pin
jparsons23-Jul-02 1:46
jparsons23-Jul-02 1:46 
GeneralRe: Correct way to try-catch in foreach loop? Pin
leppie23-Jul-02 7:17
leppie23-Jul-02 7:17 
GeneralNon-client area of controls Pin
Kastro22-Jul-02 18:32
Kastro22-Jul-02 18:32 
GeneralProperty Grid without an object Pin
Luis Alonso Ramos22-Jul-02 14:43
Luis Alonso Ramos22-Jul-02 14:43 
GeneralRe: Property Grid without an object Pin
James T. Johnson22-Jul-02 17:54
James T. Johnson22-Jul-02 17:54 
GeneralRe: Property Grid without an object Pin
Luis Alonso Ramos22-Jul-02 18:55
Luis Alonso Ramos22-Jul-02 18:55 
GeneralRe: Property Grid without an object Pin
James T. Johnson22-Jul-02 23:16
James T. Johnson22-Jul-02 23:16 
GeneralRe: Property Grid without an object Pin
leppie22-Jul-02 20:40
leppie22-Jul-02 20:40 
GeneralRe: Property Grid without an object Pin
Luis Alonso Ramos24-Jul-02 5:53
Luis Alonso Ramos24-Jul-02 5:53 
GeneralRe: Property Grid without an object Pin
Nathan Blomquist24-Jul-02 6:32
Nathan Blomquist24-Jul-02 6:32 
GeneralRe: Property Grid without an object Pin
Luis Alonso Ramos24-Jul-02 7:32
Luis Alonso Ramos24-Jul-02 7:32 
GeneralRe: Property Grid without an object Pin
Luis Alonso Ramos24-Jul-02 9:49
Luis Alonso Ramos24-Jul-02 9:49 
GeneralRe: Property Grid without an object Pin
Nathan Blomquist24-Jul-02 10:14
Nathan Blomquist24-Jul-02 10:14 

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.