hi everybody i am a beginer n m in need of yo help i've got two classes one 4 my hardwareinfo and the other one 4 create_hdwr_info_ file both work well 2gether ,but i can't seem 2 b writing on disk. with my this statement. streamfilewrite.seek((code num - 1) * hardwareinfo.SIZE,seekorigin.begin ) this piece of code throw exception " object reference not set to an instance of an object " , and i used enum to control textboxes can anybody out there help me pls?

Have you created streamfilewrite object somewhere?
Like this:

Dim streamfilewrite As FileStream
streamfilewrite = New FileStream("<path to file>", FileMode.Open)

teme64 thank u 4 that light shining line it realy helped now i struggle with writing my 2nd record in a file it throw'process cannot access file c:\.... file being used by another process' can anybody please help me. thanx

It's your own process which is using the file :) You have to close stream after you've used it:

streamfilewrite.Close()

otherwise, next time your code executes streamfilewrite = New FileStream("<path to file>", FileMode.Open) you get that exception.
The whole process should look something like this:

Dim hwInfo(hardwareinfo.SIZE) As Byte
Dim streamfilewrite As FileStream
streamfilewrite = New FileStream("<path to file>", FileMode.Open)
' Fill hwInfo buffer with your data
' Seek position
streamfilewrite.Seek((codenum - 1) * hardwareinfo.SIZE, SeekOrigin.Begin)
' Write buffer
streamfilewrite.Write(hwInfo, 0, hardwareinfo.SIZE)
' Close the stream
streamfilewrite.Close()

wow thank you teme64 it works.Consider this thread solved

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.