Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27078

VS 2010 2 forms - 2nd pulls data from a text file in the 1st

$
0
0
I have 2 forms: The first one loads a text file and populates a listbox with the first field of each line. The second form then takes what is currently selected in the listbox on form 1 and reads the rest of the fields and populates it in textboxes and a radio button on form 2.

Here is what I have for the button click on form 2, but it is not doing anything. My minimal understanding of VB tells me the logic is right, but obviously my execution is not. Any pointers?
Code:

Private Sub btnRecord_Click(sender As System.Object, e As System.EventArgs) Handles btnRecord.Click
        Dim fields() As String = IO.File.ReadAllLines("Myfile.txt")
        fields = Split(","c)
        Dim first_info As String = frmONE.lstOutput.SelectedItem
        If fields(0) = first_info Then
            txtFirst.Text = fields(0)
            txtSecond.Text = fields(1)
            txtThird.Text = fields(3)
            txtFourth.Text = fields(4)
            If fields(2) = "T" Then
                radT.Checked = True
            ElseIf fields(2) = "F" Then
                radF.Checked = True
            End If
        End If
    End Sub


Viewing all articles
Browse latest Browse all 27078

Trending Articles



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