Jump to content
The simFlight Network Forums

Reading the DME with vb.net


Recommended Posts

Hello,

I'm trying to receive the dme (offset 0C29), using FSUIPC_Get.

But how do I convert the value into a string???

My code:

Private Sub GetDME1()

Dim intToken As Integer

Dim dwResult As Integer

Dim bteDME1() As Byte????????????

If Not FSUIPC_Read(&HC29, 5, intToken, dwResult) Then

lblMessage.Text = "read error code: " + dwResult.ToString

Else

If Not FSUIPC_Process(dwResult) Then

lblMessage.Text = "process code: " + dwResult.ToString

End If

FSUIPC_Get(intToken, 5, bteDME1)?????????

lblDME1.Text = ????????????

End If

End Sub

Thanx,

Link to comment
Share on other sites

I'm trying to receive the dme (offset 0C29), using FSUIPC_Get.

But how do I convert the value into a string???

Well, in FS, Windows, and C/C++ terms, it IS a string already -- a sequence (array if you like) of bytes each containing a printable ASCII character value, ending with a zero byte.

As far a VB is concerned, I'm sorry, but I've no idea. VB seems to have trouble with strings, numbers, almost everything. I'll have to leave it to someone else, hopefully, to look at your code and comment.

Regards,

Pete

Link to comment
Share on other sites

After playing around a bit, I found the error; here is the correct code:

Private Sub GetDME1()

Dim intToken As Integer

Dim dwResult As Integer

Dim x(4) As Byte

lblDME1.Text = String.Empty

If Not FSUIPC_Read(&HC29, 5, intToken, dwResult) Then

lblMessage.Text = "read error code: " + dwResult.ToString

Else

If Not FSUIPC_Process(dwResult) Then

lblMessage.Text = "process code: " + dwResult.ToString

End If

FSUIPC_Get(intToken, 5, x)

For i As Integer = 0 To x.Length - 1

lblDME1.Text &= Trim(Chr(x(i)))

Next

End If

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.