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 8960083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:35:35+00:00 2026-06-15T15:35:35+00:00

I have to refactor a VB6 program to C# and am stuck at understanding

  • 0

I have to refactor a VB6 program to C# and am stuck at understanding the following lines:

Set myFileSystemObject = New FileSystemObject
Set myTextStream = myFileSystemObject.OpenTextFile("myTextFile.txt")
Open sPrinterPort For Output As iFileNumber
Print #iFileNumber, myTextStream.ReadAll
Close #iFileNumber

I do know what’s generally happening, but as I’m not used to the VB syntax, I’d like to know exactly what

Print #iFileNumber, myTextStream.ReadAll

does. And more specifically, what the # in front of iFileNumber does. Why is it there? Wouldn’t the variable itself suffice to print on the stream?

This is merely for understanding exactly what’s happening in the code.

  • 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-06-15T15:35:36+00:00Added an answer on June 15, 2026 at 3:35 pm

    Print #iFileNumber, myTextStream.ReadAll prints the string returned by ReadAll into the file opened by number iFileNumber (and because there is no semicolon after the statement, it also adds vbNewLine in the end.)

    The # (for “number”) is there since the old times. VB6 just supports it. It does nothing execution wise. It used to assist readability and make the language more natural-like. Speak out loud:

    Open "1.txt" For Input As 1
    

    vs.

    Open "1.txt" For Input As #1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to refactor a Java program created with Eclipse RCP. My predecessor handed
I have a horribly coded set of controllers which I am unable to refactor
I have the following code for adding to/extracting from Zip. I'm trying to refactor
Let's say you have to [write from scratch, rewrite, refactor] a sample program illustrating
I have a set of $.get() requests that I need to refactor to include
I now have to refactor some code, it's basically one method(its around 1000 lines
I have to refactor and maintain a bunch of horrible similar looking Java classes.
I am doing project euler question 33 and have divised a refactor to solve
I have trouble finding way to correctly refactor this code so that there would
I have got a very nasty piece of code i would like to refactor

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.