Click here to Skip to main content
15,903,362 members
Home / Discussions / C#
   

C#

 
GeneralRe: Closing a form and enable another one! Pin
alee15.10.8823-Feb-06 20:43
alee15.10.8823-Feb-06 20:43 
QuestionReading and writing to text file simultaneously Pin
liqnit23-Feb-06 3:39
liqnit23-Feb-06 3:39 
AnswerRe: Reading and writing to text file simultaneously Pin
yoaz23-Feb-06 10:00
yoaz23-Feb-06 10:00 
QuestionConvert an Image Pointer Into a Bitmap Pin
redfish3423-Feb-06 3:22
redfish3423-Feb-06 3:22 
AnswerRe: Convert an Image Pointer Into a Bitmap Pin
Nicholas Butler23-Feb-06 3:40
sitebuilderNicholas Butler23-Feb-06 3:40 
GeneralRe: Convert an Image Pointer Into a Bitmap Pin
redfish3425-Feb-06 3:24
redfish3425-Feb-06 3:24 
QuestionWMI Exceptions/Updating List View Pin
autekre23-Feb-06 3:20
autekre23-Feb-06 3:20 
AnswerRe: WMI Exceptions/Updating List View Pin
Praveen Nayak23-Feb-06 19:00
Praveen Nayak23-Feb-06 19:00 
1. This point is pretty simple, there could be many cases where you are trying to access a property of a null item which is throwing the exception.

For example, if MO["Whatever"] doesn't return a valid object, it returns a null. You are then trying to access the ToString() method over this object, which is actually null, so it is like null.ToString(). You cannot access any of the properties on null.

Ideally you must perform checks like

object temp = MO["Whatever"]
if (temp != null)
{
processItem.SubItems.Add(temp.ToString() + " Bytes");
}

Note: Null checks must be a "taken for granted" coding style.

2. I am thinking, don't clear the list. You then use listView.Contains(..) method (or a similar implementation by you) to first check if the new item is present and if it is, don't add it.
Add a reference to all the current items of the list view not checked to a collection. This will be the list that got removed (if you need that) and then remove these items from the list. There will be much less confusion this way.

There has to be more to life than just this

-- modified at 1:01 Friday 24th February, 2006
Questionpublic variables Pin
ddpn4223-Feb-06 3:08
ddpn4223-Feb-06 3:08 
AnswerRe: public variables Pin
Le centriste23-Feb-06 3:25
Le centriste23-Feb-06 3:25 
GeneralRe: public variables Pin
ddpn4223-Feb-06 14:22
ddpn4223-Feb-06 14:22 
GeneralRe: public variables Pin
Praveen Nayak23-Feb-06 19:09
Praveen Nayak23-Feb-06 19:09 
GeneralRe: public variables Pin
Le centriste24-Feb-06 1:54
Le centriste24-Feb-06 1:54 
AnswerRe: public variables Pin
StyleGuide23-Feb-06 3:33
StyleGuide23-Feb-06 3:33 
QuestionTransparent Label in Compact Framework? Pin
rnvrnv23-Feb-06 3:08
rnvrnv23-Feb-06 3:08 
Questionhow to check if client still connected to server Pin
batmanAgen23-Feb-06 2:57
batmanAgen23-Feb-06 2:57 
AnswerRe: how to check if client still connected to server Pin
Praveen Nayak23-Feb-06 19:19
Praveen Nayak23-Feb-06 19:19 
GeneralRe: how to check if client still connected to server Pin
batmanAgen23-Feb-06 21:01
batmanAgen23-Feb-06 21:01 
QuestionMicrosoft.DirectX.AudioVideoPlayback.Video Pin
kaka2223-Feb-06 2:12
kaka2223-Feb-06 2:12 
QuestionConstructor overloading Pin
spin vector23-Feb-06 1:56
spin vector23-Feb-06 1:56 
AnswerRe: Constructor overloading Pin
Nicholas Butler23-Feb-06 2:03
sitebuilderNicholas Butler23-Feb-06 2:03 
GeneralRe: Constructor overloading Pin
spin vector23-Feb-06 2:33
spin vector23-Feb-06 2:33 
AnswerRe: Constructor overloading Pin
Guffa23-Feb-06 2:42
Guffa23-Feb-06 2:42 
AnswerRe: Constructor overloading Pin
Nicholas Butler23-Feb-06 2:43
sitebuilderNicholas Butler23-Feb-06 2:43 
Questionthreading problem Pin
Areff23-Feb-06 1:52
Areff23-Feb-06 1:52 

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.