Hi..I have a file which looks like this
txtBox1|4
txtBox2|7
txtBox3|5
I'd like to read in the file and have the values be read into the Texboxes....
so txtBox1.text has 4
I have the following code....but I need some help as it doesn't work that good...
VB Code:
Public Sub OpenBestand() On Error GoTo ErrHandle Dim elements() As String frmInput.BestandVenster.DialogTitle = "Open file..." frmInput.BestandVenster.Filter = "TXT File(*.txt)|*.txt|All Files(*.*)|*.*" frmInput.BestandVenster.FilterIndex = 1 frmInput.BestandVenster.ShowOpen fnum = FreeFile FileName = frmInput.BestandVenster.FileName Open FileName For Input As #fnum Do Until EOF(1) Line Input #fnum, data elements = Split(data, "|") "frmInput." & elements(UBound(elements) - 1) & ".value" = elements(UBound(elements)) MsgBox EOF(1) Loop Close #fnum Exit Sub




Reply With Quote