Quantcast
Viewing all articles
Browse latest Browse all 27072

Why does my program simply hang?

Hey Guys
Im trying to write a little DB with a txt file using ; and , as sorting chars.

The problem is I get the first guys info but then it freezes and doesnt display anything further it just freezes.

Its suppose to look for " ; " and then take that string before the " ; " and process it and then continue on to the next " ; " etc.

Hers the code

Code:

Imports System.IO

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Public Sub ReadFile()
        Dim myRead As New StreamReader("J:\Users\XXXX\Documents\Visual Studio 2010\Projects\Assign1\DB.dat")
        PopulateArray(myRead.ReadToEnd)
        myRead.Close()
    End Sub

    Public Sub PopulateArray(ByVal FileString As String)
        Dim Sum As Integer = 0
        Dim Count As Integer = 0
        Dim OldCount As Integer = 0
        Dim SubStr As String = 0

        While (FileString.IndexOf(";", Count) <> -1)
            Sum += 1
            OldCount = Count
            Count = FileString.IndexOf(";", Count) + 1
            SubStr = FileString.Substring(OldCount, Count - 1)
            'TextBox1.AppendText("Old:" & OldCount & ".")
            'TextBox1.AppendText("New:" & Count & ".")
            'ExtractInfo(SubStr)
            TextBox1.AppendText(SubStr)
        End While
        TextBox1.AppendText(Sum)
        'TextBox1.AppendText(SubStr)
    End Sub

    Public Sub ExtractInfo(ByVal Subs As String)

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        ReadFile()
    End Sub
End Class

heres the Text files data
Code:

",326246,Konswaila Nagasaki,47894381,08/16/2016,,Ford,2008,Fiesta,Black,";" 001,Eckart Gerber,000154,02/13/2012,,Mazda,1980,323,Green,";

Viewing all articles
Browse latest Browse all 27072

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>