Click here to Skip to main content
15,915,076 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: how to list the datas in combobox or listbox? Pin
Ashfield23-Sep-08 1:37
Ashfield23-Sep-08 1:37 
GeneralRe: how to list the datas in combobox or listbox? Pin
dileep.arangod23-Sep-08 2:04
dileep.arangod23-Sep-08 2:04 
AnswerRe: how to list the datas in combobox or listbox? Pin
~Khatri Mitesh~22-Sep-08 22:17
~Khatri Mitesh~22-Sep-08 22:17 
QuestionDividing image iton different segments, Pin
Rngrgreen22-Sep-08 18:29
Rngrgreen22-Sep-08 18:29 
QuestionSerial Port.. Pin
Subjugate22-Sep-08 14:36
Subjugate22-Sep-08 14:36 
AnswerRe: Serial Port.. Pin
Ashfield22-Sep-08 21:11
Ashfield22-Sep-08 21:11 
AnswerRe: Serial Port.. Pin
Levisvv15-Oct-08 9:09
Levisvv15-Oct-08 9:09 
QuestionFormatting question [modified] Pin
Sonhospa22-Sep-08 11:45
Sonhospa22-Sep-08 11:45 
Hello everybody,

I'm new to VB 2008 and need some advice on formatting of different data types in a list box. The result is confusing for me, but still I guess it's easy for someone with more experience.

The retrieved values seem to be positioned well, as I figure when I see that the 100th value - a string - gives me the expected (readable) result. But - trying and studying and trying and searching sources - I can't find out how to format the DWORD and BYTE Types so that they show me correct results in my list box... EDIT: As I just found out, it's important to mention that the file(s) header use BIG-ENDIAN order while I'm working on a PC.

I'm afraid I'm messing up several issues WTF | :WTF: At least it seems to be the completely wrong way to just "ToString" the resulting variables..
Result examples:
- A file of 8.302.592 bytes shows me a filesize of "11566592" (and maybe that's even the size stamp in the header? I really can't tell..).
- A TimeCode of 06:00:42:11 shows "289538054"

Do I probably miss any transformation issues? Or is something generally wrong wit my code? How can I format these values properly to be a readable format???

Here's what I do:
In a small project class I use a binary reader to read the header of a bitmap file into variables of data types BYTE and DWORD (which is obviously UInt32 in VB?).

</code>
'Variables (excerpt):
Dim hByte As Byte = Nothing
...
Dim hDWORD As UInt32 = Nothing
</code>

The Header is read with statements like:
<code>
'Read the header (excerpts):
hString = br.ReadChars(4)
.pictype = hString

hDWORD = br.ReadUInt32
.fileoffset = hDWORD
'...(etc)
hDWORD = br.ReadUInt32
.TimeCode = hDWORD
</code>

With the resulting variables I fill a listbox:
<code>
With lstBox
.Items.Clear()
.Items.Add("PicType: " & struct.pictype )
.Items.Add("ImageOffset: " & struct.offset) 'DWORD
.Items.Add("File Size: " & struct.fileSize.ToString & " bytes") 'DWORD
.Items.Add("Version: " & struct.version)
.Items.Add("SMPTE TimeCode: " & tv.TimeCode.ToString) 'DWORD
...
End With
</code>

Could someone please help me jump over that hurdle?

Thank you, kind regards
Michael

<div class="ForumMod">modified on Tuesday, September 23, 2008 2:29 AM</div>
AnswerRe: Formatting question Pin
Johan Hakkesteegt24-Sep-08 2:06
Johan Hakkesteegt24-Sep-08 2:06 
QuestionRe: Formatting question Pin
Sonhospa25-Sep-08 0:29
Sonhospa25-Sep-08 0:29 
QuestionRe: Formatting question Pin
Sonhospa25-Sep-08 0:54
Sonhospa25-Sep-08 0:54 
AnswerRe: Formatting question Pin
Johan Hakkesteegt25-Sep-08 1:01
Johan Hakkesteegt25-Sep-08 1:01 
QuestionRe: Formatting question Pin
Sonhospa25-Sep-08 1:33
Sonhospa25-Sep-08 1:33 
AnswerRe: Formatting question Pin
Johan Hakkesteegt25-Sep-08 3:30
Johan Hakkesteegt25-Sep-08 3:30 
GeneralRe: Formatting question Pin
Sonhospa25-Sep-08 6:57
Sonhospa25-Sep-08 6:57 
GeneralRe: Formatting question Pin
Johan Hakkesteegt25-Sep-08 19:51
Johan Hakkesteegt25-Sep-08 19:51 
GeneralRe: Formatting question Pin
Sonhospa25-Sep-08 22:17
Sonhospa25-Sep-08 22:17 
AnswerRe: Formatting question Pin
Johan Hakkesteegt25-Sep-08 0:57
Johan Hakkesteegt25-Sep-08 0:57 
AnswerRe: Formatting question Pin
Sonhospa25-Sep-08 1:37
Sonhospa25-Sep-08 1:37 
QuestionFile Counting in VB Pin
Sonhospa22-Sep-08 11:23
Sonhospa22-Sep-08 11:23 
AnswerRe: File Counting in VB Pin
Gagan.2023-Sep-08 1:10
Gagan.2023-Sep-08 1:10 
GeneralRe: File Counting in VB Pin
Sonhospa23-Sep-08 1:42
Sonhospa23-Sep-08 1:42 
GeneralRe: File Counting in VB Pin
Dave Kreskowiak23-Sep-08 2:02
mveDave Kreskowiak23-Sep-08 2:02 
NewsRe: File Counting in VB Pin
Sonhospa23-Sep-08 2:07
Sonhospa23-Sep-08 2:07 
NewsRe: File Counting in VB [modified] Pin
Sonhospa23-Sep-08 3:01
Sonhospa23-Sep-08 3:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.