Jump to content
The simFlight Network Forums

Load flight FS2004 Visual Basic


Recommended Posts

Hi, I`m wondering if anybody can help me with what is probably an easy fix. I want to write the command to load a saved flight from within a visual basic instructors station I am writing. Whener I give it a value to load I get a VB exception.

eg..

Dim flight As Offset(Of Short) = New FSUIPC.Offset(Of Short)(&3F00, True)

Private Sub btnload_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnload.Click

flight.value = savedflight1.flt

End Sub

Any help would be appreciated, I am but a novice at this :)

Thankyou in advance

Link to comment
Share on other sites

To load or save a Flight (.FLT) you first set up the pathname (and optional description) at offset 3F04 below, then write here. Write one of these values:

0 to simply load the specified flight/situation.

1 to save the flight/situation with no description

257 to save the flight/situation with a description

Flights are saved in the ―My Documents‖ FS folder. Flights are loaded by default from there too – you don‘t have to specify a path.

If you are Loading a file, please allow time for the file to load before expecting any further meaningful response across the FSUIPC interface. FSUIPC will probably not be able to respond for several seconds even on the fastest machines.

Hi, I`m wondering if anybody can help me with what is probably an easy fix. I want to write the command to load a saved flight from within a visual basic instructors station I am writing. Whener I give it a value to load I get a VB exception.

eg..

Dim flight As Offset(Of Short) = New FSUIPC.Offset(Of Short)(&3F00, True)

Private Sub btnload_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnload.Click

flight.value = savedflight1.flt

End Sub

Any help would be appreciated, I am but a novice at this :)

Thankyou in advance

Link to comment
Share on other sites

Hi, many thanks for your swift reply, I am just wondering how the code is written in VB to make this happen? I am very novice at this!

Thanks in advance, Chris

I did't check it but it will work

Private Sub btnload_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnload.Click

'if fsuipc not already open then add the bellow

Try

FSUIPCConnection.Open()

end try

Try

FSUIPCConnection.Process()

Dim loadsave As Offset(Of Short) = New FSUIPC.Offset(Of Short)(&3F00)

Dim flightname As Offset(Of string) = New FSUIPC.Offset(Of string)(&3F04, 252)

flightname.value="savedflight1.flt"

loadsave.value=0 ' to simply load the specified flight/situation.

'loadsave.value=1 ' to save the flight/situation with no description

'loadsave.value=257 ' to save the flight/situation with a description

End Try

end sub

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.