Click here to Skip to main content
15,897,891 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Draging a control within a control on windows form Pin
Christian Graus22-Aug-07 12:56
protectorChristian Graus22-Aug-07 12:56 
GeneralRe: Draging a control within a control on windows form Pin
BooleanTrue23-Aug-07 0:48
professionalBooleanTrue23-Aug-07 0:48 
Questionshell command problems Pin
plural22-Aug-07 5:23
plural22-Aug-07 5:23 
AnswerRe: shell command problems Pin
Craster22-Aug-07 5:56
Craster22-Aug-07 5:56 
GeneralRe: shell command problems Pin
plural22-Aug-07 6:22
plural22-Aug-07 6:22 
QuestionWeb Services Pin
susheel7422-Aug-07 5:17
susheel7422-Aug-07 5:17 
AnswerRe: Web Services [modified] Pin
nlarson1122-Aug-07 11:24
nlarson1122-Aug-07 11:24 
QuestionFileStream.Write doing odd things... Pin
andycee22-Aug-07 4:22
andycee22-Aug-07 4:22 
Hi,

I'm having FileStream.Write behave rather oddly.

The code below should take file a.txt and append it to file b.txt :

        Dim buffer As Byte()<br />
        Dim bytesRead As Integer<br />
        Dim fStreamIN As New FileStream("c:\a.txt", FileMode.Open, FileAccess.Read)<br />
        Dim fStreamOUT As New FileStream("c:\b.txt", FileMode.Append, FileAccess.Write)<br />
        ReDim buffer(fStreamIN.Length)<br />
 <br />
        bytesRead = fStreamIN.Read(buffer, 0, fStreamIN.Length)<br />
        MsgBox("Read bytes:" + Str(bytesRead) + " Expected:" + Str(fStreamIN.Length))<br />
        MsgBox("byte 1:" + Chr(buffer(0)) + vbCrLf + _<br />
"byte 2:" + Chr(buffer(1)) + vbCrLf + _<br />
"byte 3:" + Chr(buffer(2)) + vbCrLf)<br />
        fStreamOUT.Write(buffer, 0, buffer.Length)<br />
 <br />
        fStreamOUT.Flush()<br />
        fStreamIN.Close()<br />
        fStreamOUT.Close()


I test with :

a.txt "abc"
b.txt "<this is="" the="" orig="">"

Now when I run this code, the characters in a.txt are read correctly to buffer, but the file b.txt contains :

"<this is="" the="" orig="">扡c"

What on earth is going on ???

cheers guys
AnswerRe: FileStream.Write doing odd things... Pin
Colin Angus Mackay22-Aug-07 4:53
Colin Angus Mackay22-Aug-07 4:53 
AnswerRe: FileStream.Write doing odd things... Pin
Luc Pattyn22-Aug-07 5:00
sitebuilderLuc Pattyn22-Aug-07 5:00 
Questionimage and my.resources (wpf) Pin
Roberto Monza22-Aug-07 4:00
Roberto Monza22-Aug-07 4:00 
AnswerRe: image and my.resources (wpf) Pin
Shimmy Weitzhandler13-Sep-09 22:11
Shimmy Weitzhandler13-Sep-09 22:11 
QuestionData Access Layer and Enterprise Library Pin
jesusnaun22-Aug-07 3:53
jesusnaun22-Aug-07 3:53 
QuestionFormula Pin
iain659422-Aug-07 1:47
iain659422-Aug-07 1:47 
AnswerRe: Formula Pin
ejaz_pk22-Aug-07 3:45
ejaz_pk22-Aug-07 3:45 
GeneralRe: Formula Pin
iain659422-Aug-07 4:23
iain659422-Aug-07 4:23 
GeneralRe: Formula Pin
Mycroft Holmes22-Aug-07 22:21
professionalMycroft Holmes22-Aug-07 22:21 
QuestionWriting word document in vb.net Pin
Salman Sheikh22-Aug-07 1:26
Salman Sheikh22-Aug-07 1:26 
QuestionChanging date format Pin
Ahamed Azeem22-Aug-07 0:34
Ahamed Azeem22-Aug-07 0:34 
AnswerRe: Changing date format Pin
plural22-Aug-07 0:51
plural22-Aug-07 0:51 
GeneralRe: Changing date format Pin
Ahamed Azeem22-Aug-07 2:12
Ahamed Azeem22-Aug-07 2:12 
AnswerRe: Changing date format Pin
ejaz_pk22-Aug-07 1:16
ejaz_pk22-Aug-07 1:16 
AnswerRe: Changing date format Pin
Salman Sheikh22-Aug-07 1:22
Salman Sheikh22-Aug-07 1:22 
GeneralRe: Changing date format Pin
Ahamed Azeem22-Aug-07 2:15
Ahamed Azeem22-Aug-07 2:15 
GeneralRe: Changing date format Pin
Salman Sheikh28-Aug-07 0:23
Salman Sheikh28-Aug-07 0:23 

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.