Nobody Knows about ReplacementStrings or is it just Google

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I can´t find anything *usefull* about replacement strings, even on google!

Anyone know how to deal with the ReplacementStrings from the LogEntry class?

When you read a LogEntry.Messages that has extended characters or whatnot,
it throws an exception about converstion overflow - well, there is something
to do with replacementStrings, I just can´t figure how to get pass this.

I´ve tried the most absurd things to get through (I won´t even post what I
have tried or else my gene pool would be haunted by this for centuries).

any help is appreciated.
 
I can´t find anything *usefull* about replacement strings, even on google!

Anyone know how to deal with the ReplacementStrings from the LogEntry class?

When you read a LogEntry.Messages that has extended characters or whatnot,
it throws an exception about converstion overflow - well, there is something
to do with replacementStrings, I just can´t figure how to get pass this.

I´ve tried the most absurd things to get through (I won´t even post what I
have tried or else my gene pool would be haunted by this for centuries).

Which LogEntry class are you referring to?
 
the System.Diagnostics.EventLogEntry

What I am doing is I am going through the log file, entry by entry, and
thats is fine, I can get all the data I need. But When I come across some
entries (with localized chars, like "não" it errors with an exception like
overflow exception of some sort)

It states in the documentation:
<sdk>
Remarks
Getting this property opens the registry to determine the filename of the
..dll file containing the localized text. If you receive a Registry error
when testing your source code, verify the .dll file's existence on the
computer. If insertion strings are included in the message, catch errors in
their allocation.

</sdk>

Now, so I catch the error, and there are strings in the ReplacementStrings
member of the eventlogentry.

Now what?
 
Hi Cablito,

Please to not double post I was sending this message to the other one.

I hope this helps anyhow?

Cor

Dim myEventLog As New Diagnostics.EventLog("System", ".")
Dim myLogEntryCollection As _
EventLogEntryCollection = myEventLog.Entries
For i As Integer = myLogEntryCollection.Count - 1 To 0 Step -1
Dim myLogEntry As EventLogEntry = myLogEntryCollection(i)
Dim mystrings() As String = myLogEntry.ReplacementStrings
For Each str As String In mystrings
Console.WriteLine(str)
Next
Next
 
Thanks, I´ll check that as soon as I get to my dev machine.

Ahh, I haven´t used newsgroups for the last god-knows how many years, double
posting is just unavoidable when u are desperate :) lol.

I wish I had all the time to cooperate more on newsgroups as I once did. I
almost feel bad about being helped when I haven´t helped anyone in ages ...
but thats just me.
 
the System.Diagnostics.EventLogEntry

What I am doing is I am going through the log file, entry by entry, and
thats is fine, I can get all the data I need. But When I come across some
entries (with localized chars, like "não" it errors with an exception like
overflow exception of some sort)

First of all, I presume you're talking about the Message property (you
didn't say).

I suggest that you put a try-catch block around your access to the Message
property and display the complete exception and post it here:

Dim msg As String
Try
msg = evt.Message
Catch ex As Exception
Debug.WriteLine(ex.ToString())
End Try
 
Back
Top