Quote Originally Posted by gep13 View Post
How big is your project, and how sensitive is the contents? Is it possible you can provide the source code so that we can have a look?

The problems seems to be in the loading, so I'll give that part first.

First, the declarations:

Code:
Dim Number As ULong
    Dim LastFound As ULong
    Dim Half As ULong
    Dim Found As ULong
    Dim Counter As ULong
    Dim TimeCounter As ULong

    Dim LastNameUsed As Integer
    Dim LenOfFile As Integer
    Dim LenOfEntry As Integer
    Dim tickCount As Integer

    Dim Iteration As Short
    Dim IterCount As Short

    Dim TotalTime As Single

    Dim ExitFlag As Boolean

    Dim FilePath As String
    Dim fName As String
    Dim idxString As String

    Dim DataFile As System.IO.StreamWriter
    Dim IdxFile As System.IO.StreamWriter

    Const AppName = "Prime2V4"
    Const idxfName = "_Index.Txt"
    Const Section = "Settings"
    Const vString = "Prime2 - v4.2.4 [20090904]"
    Const MaxSize = 1048576
Below is the form load sub:

Code:
Private Sub frmMain_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Me.Text = vString

        TimeCounter = CULng(GetSetting(AppName, Section, "TimeCounter", "0"))
        Number = CULng(GetSetting(AppName, Section, "Number", "1"))
        LastFound = CULng(GetSetting(AppName, Section, "LastFound", "0"))
        Counter = CULng(GetSetting(AppName, Section, "Counter", "0"))
        Found = CULng(GetSetting(AppName, Section, "Found", "0"))
        LastNameUsed = CShort(GetSetting(AppName, Section, "LastNameUsed", "0"))
        Iteration = CShort(GetSetting(AppName, Section, "Iteration", "0"))

        IterCount = Iteration
        TotalTime = TimeCounter / 3600
        UpdateDisplay()
        Me.shp1.FillColor = Color.Red

        FilePath = Command() & "\"

    End Sub
That sub calls "UpdateDisplay" which is fired by a timer at one second intervals, once it is enabled.
Code:
Sub UpdateDisplay()

        Me.lblTested.Text = FormatNumber(Counter, 0, TriState.False, TriState.False, TriState.True)
        Me.lblFound.Text = FormatNumber(Found, 0, TriState.False, TriState.False, TriState.True)
        Me.lblRunTime.Text = FormatNumber(TotalTime, 3, TriState.True, TriState.False, TriState.True)
        Me.lblLastPrime.Text = FormatNumber(LastFound, 0, TriState.False, TriState.False, TriState.True)
        Me.lblFileName.Text = fName
        Me.lblSize.Text = FormatNumber(LenOfFile, 0, TriState.False, TriState.False, TriState.True)
        Me.lblIteration.Text = CStr(Iteration)

    End Sub
Once these three finish, the program just sits and waits for a command button to be clicked.

Whatever the problem is, it is right here.