PC Review


Reply
Thread Tools Rate Thread

Cannot get rid of these exceptions

 
 
Patrick Penet
Guest
Posts: n/a
 
      29th Feb 2004
Again I need your help, cuz I'm out of idea !

I get an error at runtime at the indicated line :
System.NullReferenceException occured in MyApp.exe

If I continue, I get :
System.TypeInitializationException occured in unknown module ...

Help on these matters is chinese to me.

In a standard module :
'====
Public tbxOtherPilotFullPath As Collection = New Collection

Sub tbxOPENTBXCFG(ByVal sMyFullPath As String)
Dim t As String
Dim SR As StreamReader = New StreamReader(sMyFullPath)

While Not t = vbNullString
t = SR.ReadLine()
tbxOtherPilotFullPath.Add(t) '<=== Error here !!!
End While

SR.Close()
End Sub
'====

When hovering on the variable t, it shows the expected string.
I have been feeding collections many times without a problem
so I can't understand why it don't work this time.

Thank you for any help.
Patrick



 
Reply With Quote
 
 
 
 
Patrick Penet
Guest
Posts: n/a
 
      1st Mar 2004
Because the call to the sub was made from MyForm Sub New()
I just discovered (finally) this was the *REAL* entry point of my app
before Sub Main() although indicated in the app property page,
therefore the collection was never initialized.

The teaching is 'I will never again call an external sub from New()'
(it took me a while !) ;-(
P.



"Patrick Penet" <(E-Mail Removed)> a écrit dans le message de news:404229d4$0$5918$(E-Mail Removed)...
> Again I need your help, cuz I'm out of idea !
>
> I get an error at runtime at the indicated line :
> System.NullReferenceException occured in MyApp.exe
>
> If I continue, I get :
> System.TypeInitializationException occured in unknown module ...
>
> Help on these matters is chinese to me.
>
> In a standard module :
> '====
> Public tbxOtherPilotFullPath As Collection = New Collection
>
> Sub tbxOPENTBXCFG(ByVal sMyFullPath As String)
> Dim t As String
> Dim SR As StreamReader = New StreamReader(sMyFullPath)
>
> While Not t = vbNullString
> t = SR.ReadLine()
> tbxOtherPilotFullPath.Add(t) '<=== Error here !!!
> End While
>
> SR.Close()
> End Sub
> '====
>
> When hovering on the variable t, it shows the expected string.
> I have been feeding collections many times without a problem
> so I can't understand why it don't work this time.
>
> Thank you for any help.
> Patrick
>
>
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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
do release builds have the same amount of info in exceptions? e.g. will exceptions cought in release builds contain stack trace etc.? Daniel Microsoft Dot NET 1 25th Sep 2007 12:24 PM
do release builds have the same amount of info in exceptions? e.g. will exceptions cought in release builds contain stack trace etc.? Daniel Microsoft ADO .NET 1 25th Sep 2007 12:06 PM
do release builds have the same amount of info in exceptions? e.g. will exceptions cought in release builds contain stack trace etc.? Daniel Microsoft C# .NET 1 25th Sep 2007 12:14 AM
Sample program: Try / Catch exceptions user defined exceptions derived from System.Exception raylopez99 Microsoft C# .NET 2 23rd Sep 2007 10:47 AM
Exceptions in exceptions in webservices Jimmy Microsoft Dot NET Compact Framework 0 11th May 2004 03:06 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:45 AM.