Need Visual Basic code to write bytes into file

Visual basic - Write into binary file

Page 1 of 1

3 Replies - 13539 Views - Last Post: 22 August 2005 - 07:44 AM Rate Topic: -----

#1 sgpriya  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 21-July 05

Need Visual Basic code to write bytes into file

Posted 21 July 2005 - 09:31 AM

Hi,
I have generated bytes from webservice and I am able to write into file using visual basic.NET by using the following code where bytReturn value comes from web service.
 Dim s1 As IO.FileStream
        s1 = New IO.FileStream(sFileName, IO.FileMode.Create, IO.FileAccess.Write)

        Dim bw As IO.BinaryWriter
        bw = New IO.BinaryWriter(s1)

        Try
            bw.Write(bytReturn)
        Finally
            bw.Close()
            s1.Close()
        End Try


This code works fine. I need to write the same code using visual basic 6.0. I am able to call the web service from visual basic and I don't know the code to write into the file.

Any help is kindly appreciated.

Kind Regards,
Priya

Is This A Good Question/Topic? 0
  • +

Replies To: Need Visual Basic code to write bytes into file

#2 burndailer  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 26
  • Joined: 06-June 05

Re: Need Visual Basic code to write bytes into file

Post icon  Posted 22 July 2005 - 03:47 AM

sgpriya, on Jul 21 2005, 09:31 AM, said:

Hi,
I have generated bytes from webservice and I am able to write into file using visual basic.NET by using the following code where bytReturn value comes from web service.
 Dim s1 As IO.FileStream
        s1 = New IO.FileStream(sFileName, IO.FileMode.Create, IO.FileAccess.Write)

        Dim bw As IO.BinaryWriter
        bw = New IO.BinaryWriter(s1)

        Try
            bw.Write(bytReturn)
        Finally
            bw.Close()
            s1.Close()
        End Try


This code works fine. I need to write the same code using visual basic 6.0. I am able to call the web service from visual basic and I don't know the code to write into the file.

Any help is kindly appreciated.

Kind Regards,
Priya

Hi there,

Maybe this will help you a little bit. Link.
This is how about to write text to a file.

Greetz Burny.
Was This Post Helpful? 0
  • +
  • -

#3 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,506
  • Joined: 12-July 02

Re: Need Visual Basic code to write bytes into file

Posted 22 July 2005 - 08:34 AM

sgpriya, just to be clear, do you need to write text to a file, or do you want to create and write to a binary file?
Was This Post Helpful? 0
  • +
  • -

#4 LemonMan  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 15
  • View blog
  • Posts: 170
  • Joined: 22-August 05

Re: Need Visual Basic code to write bytes into file

Posted 22 August 2005 - 07:44 AM

sgpriya, on Jul 21 2005, 09:31 AM, said:

Hi,
I have generated bytes from webservice and I am able to write into file using visual basic.NET by using the following code where bytReturn value comes from web service.
 Dim s1 As IO.FileStream
        s1 = New IO.FileStream(sFileName, IO.FileMode.Create, IO.FileAccess.Write)

        Dim bw As IO.BinaryWriter
        bw = New IO.BinaryWriter(s1)

        Try
            bw.Write(bytReturn)
        Finally
            bw.Close()
            s1.Close()
        End Try


This code works fine. I need to write the same code using visual basic 6.0. I am able to call the web service from visual basic and I don't know the code to write into the file.

Any help is kindly appreciated.

Kind Regards,
Priya

Just use the visual basic function Open like this:

open "file" for binary as #1
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1