Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4026668
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:59:59+00:00 2026-05-20T10:59:59+00:00

I am trying to write data to a binary file using the Print() method,

  • 0

I am trying to write data to a binary file using the Print() method, but when I run it I get the System.IO exception Bad File Mode. Does anybody have an idea of what’s going wrong here? Here’s the code for the FileOpen declaration, that might have something to do with it? Thanks

FileOpen(filenumber, "path to file", OpenMode.Binary, OpenAccess.Write, OpenShare.LockReadWrite)  
Print(filenumber, expression(variable))
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T11:00:00+00:00Added an answer on May 20, 2026 at 11:00 am

    Why are you using Print in the first place? That function is included for backwards compatibility with VB 6 applications. If you’re writing a new application in VB.NET, you should be using a different function.

    The easiest way to get off the ground quickly is using the My.Computer.FileSystem object to read and write to files. This even provides better performance than the legacy functions like FileOpen and Print. More explanation and sample code is available here on MSDN. Specifically:

    • Reading from Files in Visual Basic
    • Writing to Files in Visual Basic
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to write data stored in a binary file using turbo C++.
I want to write data into the file in binary form. I was trying
I'm trying to write binary data files from fortran, but I find the regular
I'm trying to write data to a file in binary format for compression. The
I need to write data to a binary file using C's I/O functions. The
I am trying to program using C to write binary data to a .bin
I'm trying to read binary data from a specific offset. I write the data
I am trying write a function that generates simulated data but if the simulated
I'm trying to write an extension method to insert data into a dictionary of
I'm trying to write a generic XML to Core Data parser using libxml2. Since

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.