stream problem

khumbu

New member
Joined
Mar 14, 2003
Messages
2
I hope this isnt the wrong room..
Here i go:

I figured out how to use streams but i still have a small problem
Here is the code i use (its behind a button)
It loads a bitmap puts it into a stream so i can change it.
Code:
        Dim i As Integer
        Dim mfs As FileStream
        Dim myarray(265650) As Byte
        Dim mms As New MemoryStream()

        mfs = New FileStream("WW" & 1 & ".bmp", FileMode.Open)
        mfs.Read(myarray, 1, 265650)
        mfs.Close()
  
here i write 0 to certain the elements in the array

        For i = 13879 To 50000 Step 1
            myarray(i) = 0

        Next
        
when i put the array in the mms it sets all the bytes starting from
13879 at 0 (until the end)
WHY? It should only do it from 13879 To 50000
        
        mms.Write(myarray, 1, 265650)

        pBox.Image = System.Drawing.Bitmap.FromStream(mms)
Am i missing somthing?

Ty for your help
 
Last edited by a moderator:
the value of those bytes are 0 by default.
Im not sure exactly what you are doing but i think that should help
 

Similar threads

T
Replies
0
Views
567
This_display_name_is_already_in_use_They_all_are
T
S
Replies
0
Views
152
Shan1986
S
Back
Top