Try Catch Finally , pointers and Vb.net 2005 compiler warnings
- From: "Bob" <bob@xxxxxxxxxxx>
- Date: Tue, 25 Oct 2005 15:46:14 +1300
Hi,
The compiler gives Warning 96 Variable 'cmdSource' is used before it has
been assigned a value. A null reference exception could result at runtime.
Dim cmdSource as SQlClient.SQLDataReader
Try
Set up the database read and do it.
Catch ex as system.exception
exception stuff here
Finally
cmdSource.close()
End try
Can't see a way out of this (Assuming a desire to explicity close in the
finally)
If you Dim inside the try statement you go out of scope in the finally.
Is there a tidy way to get rid of these warnings? My (was Vb.net 2003) Data
acccess class is now littered with them.
Thanks
Bob
.
- Follow-Ups:
- Re: Try Catch Finally , pointers and Vb.net 2005 compiler warnings
- From: Bob
- Re: Try Catch Finally , pointers and Vb.net 2005 compiler warnings
- From: Herfried K. Wagner [MVP]
- Re: Try Catch Finally , pointers and Vb.net 2005 compiler warnings
- From: Cor Ligthert [MVP]
- Re: Try Catch Finally , pointers and Vb.net 2005 compiler warnings
- From: CT
- Re: Try Catch Finally , pointers and Vb.net 2005 compiler warnings
- Prev by Date: Re: Killing VB softly with his song, Killing VB softly...with a song.............
- Next by Date: Re: Killing VB softly with his song, Killing VB softly...with a song.............
- Previous by thread: Re: vb.net in the 1.1 framework
- Next by thread: Re: Try Catch Finally , pointers and Vb.net 2005 compiler warnings
- Index(es):
Relevant Pages
|