Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Confused why bytes are being truncated


Reply
 
Thread Tools Display Modes
  #1  
Old 08-13-2006, 07:43 AM
sila1999 sila1999 is offline
Newcomer
 
Join Date: Nov 2004
Posts: 11
Default Confused why bytes are being truncated


I have this program which ive been working on to convert Pronto codes to a form that the Sony AX series remotes understand, however i have a problem which i cant explain why it happens.

this is what im talking about

Private Sub nx_convert()
Text49.Text = Text53.Text
If Text50.Text = "12" Then a5 = "01"
If Text50.Text = "15" Then a5 = "02"
If Text50.Text = "20" Then a5 = "03"
Text57.Text = a5 & a6 & "0000" & a7 & "00000003"
End Sub

When the program is run the a5 should be 03 but it truncates the leading zero.
The other problem im having is hot to convert the contents of text 51,52,53 to a 2 byte hex value
here is a sample pronto code
0000 0066 0000 0015 0061 0018 0030 0018 0018 0018 0018 0018 0030 0018 0030 0018 0018 0018 0018 0018 0018 0018 0030 0018 0018 0018 0030 0018 0030 0018 0018 0018 0030 0018 0018 0018 0030 0018 0030 0018 0018 0018 0018 0018 0030 020b
Attached Files
File Type: zip ccf decode.zip (3.7 KB, 3 views)

Last edited by sila1999; 08-13-2006 at 07:52 AM. Reason: added pronto code
Reply With Quote
  #2  
Old 08-13-2006, 11:56 AM
Toveling's Avatar
Toveling Toveling is offline
Contributor
 
Join Date: Oct 2003
Posts: 417
Default

You declared A5 as a byte. That's a numeric value. VB apparently allows you to assign it with = "03", but it's still incorrect. It chops off the 0 because as a number it's extraneous. Use A5 as a string.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->