vb.net - Using the same file error -


on button click have following code write in textboxes.

  dim file system.io.streamwriter     file = my.computer.filesystem.opentextfilewriter("c:/users/nick/documents/dra.txt", false)      file.writeline(namebasic)     file.writeline(lastbasic)     file.writeline(phonebasic)     file.writeline(nameemer1) 

on form load, load in notepad written, saying being used(the file) true, how can have 2 different functions(write, , read) manipulating same file out error?

the process cannot access file 'c:\users\nick\documents\dra.txt' because being used process. 

and here code onformload

        dim read system.io.streamreader     read = my.computer.filesystem.opentextfilereader("c:/users/nick/documents/dra.txt")     lblnamebasic.text = read.readline 

i sort of stuck on problem, thank you

you need close file when done writing it.

 dim file system.io.streamwriter file = my.computer.filesystem.opentextfilewriter("c:/users/nick/documents/dra.txt", false)  file.writeline(namebasic) file.writeline(lastbasic) file.writeline(phonebasic) file.writeline(nameemer1) file.close() 

Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -