0
Answer

I Cannot store strings in jagged Array

mohammed ASAKER

mohammed ASAKER

13y
4.6k
1
I have a text file called COUNTERS_SETTINGS.DAT having the following contents:
Code:
--------------------------------------------------
[USERID]<=>COUNTER_1
[PASSWORD]<=>ADMIN1
[CONNECT_STRING]<=>DATA SOURCE=RECAT;USER ID=PAYOPER;PASSWORD=PAYOPER
--------------------------------------------------
I'm Trying to have that entries in a Jagged array of Strings like this

Array Name is : Core (2,1)

Code:
Core
        (0)                          (1)
(0) USERID             |    COUNTER_1
(1) PASSWORD        |   ADMIN1
(2) CONNECT_STRING  |    DATA SOURCE=RECAT;USER _
                    |    ID=PAYOPER;PASSWORD=PAYOPER
i USED the following Code in vb 2008 pro but it's showing me a wrong output in textbox1
it's showing :
Code:
System.String[]System.String[]System.String[]
where it should show the content of the text file

Here are my code
Code:
Imports System.IO

Public Class Form1
    Dim LINES(2) As String
    Dim core(2)() As String
    Dim LN As String


    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Label3.Text = "Please Fill Username / Password"
        Dim EqualSeparator As String() = New String() {"<=>"}

        Dim FS As FileStream = New FileStream("C:\Program Files\Counter_system\COUNTERS_SETTINGS.DAT", FileMode.Open, FileAccess.Read)
        Dim RDR As New StreamReader(FS)
        Dim I As Integer = Nothing

        While RDR.Peek <> -1
            LINES(I) = RDR.ReadLine
            core(I) = LINES(I).Split(EqualSeparator, StringSplitOptions.RemoveEmptyEntries)
            I += 1
        End While

        For j As Integer = 0 To 2
            TextBox1.Text += core(j).ToString
        Next

    End Sub
End Class