From: mp on
just learning dotnet so i write a lot of debug lines to text file so i can
track where errors occur
Private Sub Logentry(ByVal strMsg As String)
File.AppendAllText("Path to debug file\Debug.txt", strMsg +
Environment.NewLine)
End Sub

the app is a vbnet app running inside autoCad, so it acts like i'm entering
autocad command inside autocad(autocad has focus)
Main app creates worker class that does the work
worker class creates utility class that has general functions used over
various projects
utility class provides logging etc

at end of program run utility class opens the text file to read the debug
log.

in worker class:
Protected Overrides Sub Finalize()
m_acadDoc = Nothing '<----destroy reference to acad document
m_acadApp = Nothing'<----destroy reference to acad application
m_util.OpenDebugLog() '<---ask util class to open debug log file in
notepad
m_util = Nothing'<----destroy reference to utility class

MyBase.Finalize()
End Sub


in the utility class:
Sub OpenDebugLog()
Process.Start(m_DebugFileName)
End Sub



when the file opens in notepad, notepad has focus and keyboard entry goes
into log file.

this didn't use to happen, the file just opened and keyboard focus was still
"in" autocad.

any ideas what i need to do to fix it?

thanks
mark


From: Family Tree Mike on
On 4/29/2010 9:02 PM, mp wrote:
> just learning dotnet so i write a lot of debug lines to text file so i can
> track where errors occur
> Private Sub Logentry(ByVal strMsg As String)
> File.AppendAllText("Path to debug file\Debug.txt", strMsg +
> Environment.NewLine)
> End Sub
>
> the app is a vbnet app running inside autoCad, so it acts like i'm entering
> autocad command inside autocad(autocad has focus)
> Main app creates worker class that does the work
> worker class creates utility class that has general functions used over
> various projects
> utility class provides logging etc
>
> at end of program run utility class opens the text file to read the debug
> log.
>
> in worker class:
> Protected Overrides Sub Finalize()
> m_acadDoc = Nothing '<----destroy reference to acad document
> m_acadApp = Nothing'<----destroy reference to acad application
> m_util.OpenDebugLog() '<---ask util class to open debug log file in
> notepad
> m_util = Nothing'<----destroy reference to utility class
>
> MyBase.Finalize()
> End Sub
>
>
> in the utility class:
> Sub OpenDebugLog()
> Process.Start(m_DebugFileName)
> End Sub
>
>
>
> when the file opens in notepad, notepad has focus and keyboard entry goes
> into log file.
>
> this didn't use to happen, the file just opened and keyboard focus was still
> "in" autocad.
>
> any ideas what i need to do to fix it?
>
> thanks
> mark
>
>

So at some point you changed something and now focus goes to Notepad?

Just a guess, but did you used to pop up a message box after you opened
the text file in notepad? The act of opening a messagebox would have (I
believe) brought focus back to Autocad.

--
Mike
From: Andrew Morton on
mp wrote:
> just learning dotnet so i write a lot of debug lines to text file so
> i can track where errors occur
> Private Sub Logentry(ByVal strMsg As String)
> File.AppendAllText("Path to debug file\Debug.txt", strMsg +
> Environment.NewLine)
> End Sub

As an aside, the string concatenation operator in VB.NET is "&", not "+".

--
Andrew


From: mp on
Thanks, been bouncing between c# and vbnet trying to learn dotnet and in c#
i believe it changed to +
was always used to & , coming from vb6...will try to watch that.
thanks
mark

"Andrew Morton" <akm(a)in-press.co.uk.invalid> wrote in message
news:83vgklFmv9U1(a)mid.individual.net...
> mp wrote:
>> just learning dotnet so i write a lot of debug lines to text file so
>> i can track where errors occur
>> Private Sub Logentry(ByVal strMsg As String)
>> File.AppendAllText("Path to debug file\Debug.txt", strMsg +
>> Environment.NewLine)
>> End Sub
>
> As an aside, the string concatenation operator in VB.NET is "&", not "+".
>
> --
> Andrew
>


From: mp on

"Family Tree Mike" <FamilyTreeMike(a)ThisOldHouse.com> wrote in message
news:OWDNdMA6KHA.4116(a)TK2MSFTNGP02.phx.gbl...
> On 4/29/2010 9:02 PM, mp wrote:
>> when the file opens in notepad, notepad has focus and keyboard entry goes
>> into log file.
>>
>> this didn't use to happen, the file just opened and keyboard focus was
>> still
>> "in" autocad.
>>
>> any ideas what i need to do to fix it?
>>
>> thanks
>> mark
>>
>>
>
> So at some point you changed something and now focus goes to Notepad?
>
> Just a guess, but did you used to pop up a message box after you opened
> the text file in notepad? The act of opening a messagebox would have (I
> believe) brought focus back to Autocad.
>
> --
> Mike

hmm, i did change several things...that may have been one of them...have to
go back and look.
thanks
mark