Im just fishing for different ways that some of you might go about the following task. More so because im only a novice and i can do it but i would like to know if there is a different way.
I have a tabcontrol that i am going to use as an config tool for different applications. the actual parameters are listed in a textfile "$config.dat"
im searching for different things such as the string
"DISP1SCHEDULE[1]={DISP_GUN 1,COMMENT[]"
now heres the thing..
this file that im using has 2187 lines within it. normally i have created a richtextbox to load the file into and then parse it from there such as
Code:
Private Sub AppConfig_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Stop
Dim temp As String
If File.Exists(pFilepath & "\KRC\R1\System\$config.dat") Then
Dim cText As New RichTextBox
cText.LoadFile(pFilepath & "\KRC\R1\System\$config.dat", RichTextBoxStreamType.PlainText)
temp = cText.Text.Substring(cText.Text.LastIndexOf("DISP1SCHEDULE[1]={DISP_GUN 1,COMMENT[] "), cText.Text.Length - cText.Text.LastIndexOf("DISP1SCHEDULE[32]={DISP_GUN 1,COMMENT[] "))
For i As Integer = 1 To 32
cText.Find("DISP1SCHEDULE[1]={DISP_GUN 1,COMMENT[]")
Next
End If
end sub
but i have seen alot of people use a streamreader such as
Code:
If File.Exists(pFilepath & "\KRC\R1\System\$config.dat") Then
Dim nfs As FileStream = File.OpenRead(pFilepath & "\KRC\R1\System\$config.dat")
Do While nfs.Read(b, 0, b.Length) > 0
' do code to find parameters
'Set StatusBarText
Loop
is there advantages of using one over the other?