Search results

  1. rfaricy

    DataAdapter.Fill in BackgroundWorkder causes Cross-Thread exception..

    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...
  2. rfaricy

    Finding string within string?

    You could try link.InnerHtml.ToLower.Contains("next >") but I have a feeling the issue will remain.
  3. rfaricy

    Finding string within string?

    Yes it would be considered bad .NET practice to use InStr. Contains is a native VB override while InStr is a legacy function. Contains is faster and uses less memory.
  4. rfaricy

    Pass STRUCTURE as a parameter?

    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 ' ... End If 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...
  5. rfaricy

    bring form to top on notify icon click

    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 =...
  6. rfaricy

    file should be only 1kb

    Yeah. Wouldn't an uppercase K be Kelvin? :p "KB" is the proper notation for kilobyte and a kilobyte is always 1024 bytes (never 1000). :)
  7. rfaricy

    vb to

    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.
  8. rfaricy

    vb to

    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.
  9. rfaricy

    vb to

    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 ...'...
  10. rfaricy

    vb to

    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...
  11. rfaricy

    Some Text Assistance Please

    .Append(variable & vbNewLine) or .Append(variable & vbCrLf) or .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...
  12. rfaricy

    Network Share closes isn't open?

    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.
  13. rfaricy

    Vb.NET bugs

    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...
  14. rfaricy

    Vb.NET bugs

    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() X.Add("Test") End Sub End Class That produces no errors or warnings until run-time. Hence why this would...
  15. rfaricy

    Passing established connection to other Form

    I think I got your PM too late; glad it is working well for you! :)
  16. rfaricy

    Passing established connection to other Form

    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...
  17. rfaricy

    Start and End Times - Calculating

    Why not use the DateTime class instead?
  18. rfaricy

    Vb.NET bugs

    Not in VS 2005 at least. Hence why I qualified my statement with "simple logic error". :)
  19. rfaricy

    testing for ASCII file

    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...
  20. rfaricy

    CSV importing support

    Either of those works or you can always read each line, do a String.Split(",") and create your own DataSet if you want full control over the parsing routine.
Top Bottom