Results 1 to 2 of 2

Thread: [RESOLVED] [2005] BinaryWriter question

Threaded View

  1. #1

    Thread Starter
    Frenzied Member stimbo's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    1,739

    Resolved [RESOLVED] [2005] BinaryWriter question

    I've never used it before and now need to due to the amount of data that needs to be outputted takes too long from excel. I was just wondering if there is a quick way to say output the entire contents of a List (of Single). (I know it doesn't matter what the variable is - was just to clarify).

    Just as an example: Here is a simple example of what I'm sort of dealing with:

    VB Code:
    1. Private Structure ImageData
    2.         Dim XCoordinates As List(Of Integer)
    3.         Dim YCoordinates As List(Of Integer)
    4.     End Structure
    5.  
    6.     Dim Cases(4) As ImageData
    7.  
    8.  
    9.         Dim myRnd As New Random
    10.         Dim myCountX As Integer = 0
    11.  
    12.         For i As Integer = 0 To 4   'Populate with dummy data
    13.             Cases(i).XCoordinates = New List(Of Integer)
    14.             Cases(i).YCoordinates = New List(Of Integer)
    15.             myCountX = myRnd.Next(150, 400)
    16.             For x As Integer = 0 To myCountX
    17.                 Cases(i).XCoordinates.Add(myRnd.Next(20, 150))
    18.                 Cases(i).YCoordinates.Add(myRnd.Next(20, 150))
    19.             Next
    20.         Next  
    21.  
    22.  Dim myBinary As New IO.BinaryWriter(System.IO.File.Open("D:\My Documents\binary.txt", IO.FileMode.Create))
    23.  
    24. 'I have to write the Count and store that info too?
    25. 'Do I just add a loop here and output the binary data? Or is there a better way to output all the data?
    26. 'i.e. Cases(0).XCoordinates.Output All Data   (or something)
    27. myCountX = Cases(k).XCoordinates.Count
    Last edited by stimbo; Feb 7th, 2007 at 07:01 AM.
    Stim

    Free VB.NET Book Chapter
    Visual Basic 2005 Cookbook Sample Chapter

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width