Jump to content
The simFlight Network Forums

Create a Report Table


Recommended Posts

Hi,

Paul or anybody. Can you put an example table in VB .NET with the report of parking brakes? For any time that I put the parking brakes creates a line in the table with a colum: Like Name: Parking Brakes SET.

If you can´t don´t worry. I know How can I creat a table but I don´t know how can I insert the action of FSUIPC and put a correct while. Because I don´t know the times it need to run.

PD: I´m thinking do it with a rich textbox. I think is easier. How Can I put the dates here? With a while?

Link to comment
Share on other sites

Can you put an example table in VB .NET with the report of parking brakes? For any time that I put the parking brakes creates a line in the table with a colum: Like Name: Parking Brakes SET.

Hi,

I'm away at the moment so I can't give you complete code but this might point you in the right direction...

I think what you want is to detect when the parking brake changes and write a log entry.

To do this, you need to keep a note of what the last value was, so set up a variable to hold this in addition to the offset:

Dim parkBrakes as Offset(Of UShort) As New Offset(Of UShort)(&HBC8)
Dim lastParkBrakes as Boolean[/CODE]

In your main timer you need to check this last state with the current one. If it's different then add your log entry. (I've just put a dummy method here for the log entry).

In the Timer_Tick()

[CODE]
FSUIPCConnection.Process()
Dim currentParkBrakes as Boolean
currentParkBrakes = (parkBrakes.Value > 0)
If currentParkBrakes <> lastParkBrakes Then
lastParkBrakes = currentParkBrakes
Dim Message as String = IIF(currentParkBrakes, "Parking brake ON", "Parking Brake OFF")
WriteLogEntry(Message)
End If[/CODE]

This will run every tick waiting for the value to change. When it does, it write the log and waits for the next change.

PD: I´m thinking do it with a rich textbox. I think is easier. How Can I put the dates here? With a while?

To handle the date, it depends how you record the log:

1. For a text box (or rich text box) just get the string value of the current date and time using one of the built-in formats (I suggest using "G"):

[CODE]DateTime.Now.ToString("G")[/CODE]

and add this into the message text.

2. For a memory Table just create a column with type DateTime and put the current date and time in:

[CODE]Dim newRow as DataRow = MyLogTable.NewRow()
newRow("EntryDateTime") = DateTime.Now[/CODE]

Hope that helps. If you need any more help just ask...

Paul

  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • 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.