You need to create a Delegate on your form that will handle the other thread's events. Any time you try to update one thread's form's UI from a seperate thread, you need a delegate, as if anything goes awry, your app could potentially hang.
Unfortunately I am at home and do not have any...
Absolutely, it's a huge clue. Think of "Select Case" as an "If" statement. This is what your above code looks like:
If Register = Register.PC Then
Register is a class while PC is an integer member of that class. That would be like doing this (humor me for a moment and...
Unfortunately this does not always work in .NET 2.0. It will activate the form in the context of the application but will not usually bring said form to the front in the context of all open windows. Whether this is a bug or not, I don't know.
Here's how I do it:
Dim OriginalState As Boolean =...
I think there is a way to get a MethodBase (of the TargetSite) off the Exception object; I'll have to look into it this week. This was something I was looking for long ago, when I wanted to log exceptions with all the arguments that were passed to a method.
Sure, however GetCurrentMethod exposes properties which Exception does not, especially arguments.
These are merely examples which can be custom-fit. I don't intend my code to be final; I write it to give people the opportunity to learn from and customize.
I try. :) It's more fun to help than write it every day for work (but that's still pretty fun). But yeah there's a lot of "hidden" stuff .NET offers us which VB6 never even came close to. When I first found out about Path.Combine I nearly died. Years of 'If Right(string, 1) = "\" Then ...'...
You will need to reference System.IO for the below to work verbatim. Otherwise you'll need to add "System.IO." before Path.Combine and StreamWriter(sFullPath, True) ...
' the single quotes around the separators in .ToString below force it to always remain an underscore:
Dim sFilename As String...
.Append(variable & vbNewLine)
.Append(variable & vbCrLf)
.Append(variable & Environment.NewLine)
The last example would be the proper .NET way if you aren't on .NET 2.0 framework. The first two do the same thing, but it's always a good idea to get out of the habit of using old-school...
One way is to catch the exception and re-try. Or perhaps do a DirectoryExists() and that may re-open the connection. Or map a network drive, as Windows then takes care of all that behind-the-scenes stuff.
Umm, what? I think you're confused.
"X" is of type ArrayList, not of type MyClass. ArrayList does in fact have "Add" as a keyword. So I think you need to re-read what I typed.
If you drop that into a code file and use it, it will generate absolutely ZERO errors and ZERO warnings until runtime...
I do program with Explicit and Strict to On. Always have. And that example happens. But not when you do:
Public Class MyClass
Private X As ArrayList
Public Sub New()
That produces no errors or warnings until run-time. Hence why this would...
You can create a public class or structure, assign its variables your Form1 variables, and set Form2's Tag to that class instance. Then to access it in Form2, you do a:
Dim X As MyClass = DirectCast(Me.Tag, MyClass)
Now "X" is a reference to the class from Form1, and you may access any...
A messy way would be to read every 10 bytes and average the ASCII codes. If the average stays within a certain range, you can be fairly sure it's "ASCII" as far as the concept of readable text is concerned.
To be sure it is in proper CSV format, you can get the number of commas in the first...