Shalini_7 14 Newbie Poster

Hi. here is my code, actually what i meant is , i have created a button called button into my exe, and linked it to text file. so when user click on the update button, it will copy all the text file data into the exe.

i tried it works, but it only updating the last data.

any ideas?

Private Sub ButtonUpdate_Click(sender As System.Object, e As System.EventArgs) Handles ButtonUpdate.Click

    Dim Lines() As String
    Dim SplitText() As String
    Dim PLArraySize As Integer = 1
    Dim PLExist(0) As String
    Dim ItemNumberArraySize As Integer = -1
    Dim ItemNumberExist(0) As String

    If IO.File.Exists(MLabelPath) Then
        Lines = IO.File.ReadAllLines(MLabelPath)

        For i As Integer = 1 To Lines.Length - 1

            SplitText = Lines(i).Split(vbTab)

            ProductionDataGridView.Rows(index).Cells(0).Value = SplitText(0).ToString.Trim
            ProductionDataGridView.Rows(index).Cells(1).Value = SplitText(1).ToString.Trim
            ProductionDataGridView.Rows(index).Cells(2).Value = SplitText(4).ToString.Trim
            ProductionDataGridView.Rows(index).Cells(3).Value = SplitText(2).ToString.Trim
            ProductionDataGridView.Rows(index).Cells(4).Value = SplitText(5).ToString.Trim
            ProductionDataGridView.Rows(index).Cells(5).Value = SplitText(6).ToString.Trim

        Next

        ' Cursor.Current = Cursors.Default
    Else
        MessageBox.Show("File is loading." & vbCrLf & "Please Try Again.")
    End If

    MessageBox.Show("Modular Label is Added!", "Information Added", MessageBoxButtons.OK, MessageBoxIcon.None)

End Sub
AndreRet commented: When you say "last data", is this the last line of the text file or what are you referring to? +14
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.