Visual Basic "File Open"

Soldato
Joined
24 Oct 2003
Posts
3,193
Location
Club Skalva™
Hi.

I'm currently coding a simple database that needs to save and open individual files with eight different pieces of data from eight different fields.

I've made the system to be able to save but can't get it to open.

Here's what I have so far:

Code:
txtNamesur.Text = frmInput.txtSurname.Text & frmInput.txtForename.Text & frmInput.cboClass.Text
txtName.Text = frmInput.txtSurname.Text & ", " & frmInput.txtForename.Text
Dim DataToDisplay As String
FileName = txtNamesur.Text
Open FileName For Input As #1
Do While Not EOF(1)
    Line Input #1, DataToDisplay
    txtGrade1.AddItem DataToDisplay
    Loop
    Close #1
End Sub

Basicaly on the previous form you enter the student name etc which is alos what the files are saved as. So the Open Filename command is opening whatever "Filename" has been defined as.

The form that the information is having to be entered into is an exact copy of what it's saved from. So basicaly I need it to be able to save and open the file but keep the text in the correct boxes.

This is the Input and Output screens:

input.JPG
output.JPG


Someone please help.

Cheers :)
 
Don't want to ruin your project but I think you are probably heading down a route the will cause you more and more problems.

Use 1 file and make it XML while you're at it.

It would look something like this
Code:
<students>
    <student name="Joe Bloggs">
        <subjects>
            <subject name="Maths" grade="A" />
            <subject name="Physics" grade="C" />
        </subjects>
    </student>
    <student name="A N Other">
        .....
    </student>
</students>

Look up help on MSXML and XPATH. Once you've started using it it will seem so much simpler than "File Open" shenanigans.
 
Back
Top Bottom