carlosuc99 Posted January 26, 2013 Report Share Posted January 26, 2013 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 More sharing options...
Paul Henty Posted January 28, 2013 Report Share Posted January 28, 2013 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 BooleancurrentParkBrakes = (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 1 Link to comment Share on other sites More sharing options...
carlosuc99 Posted January 28, 2013 Author Report Share Posted January 28, 2013 Thanks Paul, You´re a crack!! I only change one thing: Dim Message as String = IIF(currentParkBrakes, "Parking brake ON", "Parking Brake OFF")[/CODE][CODE]Dim Message as String += IIF(currentParkBrakes, "Parking brake ON", "Parking Brake OFF")[/CODE]I want a blackbox!! Thanks!! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now