Question about Computers & Internet

2 Answers

File handling in visual basic 6.0

Related to file handling give me complete details

Posted by on

  • expnit May 08, 2009

    i want to open any application from program files then open file of that type in same application & access menu of that application from vb? (e.g. handle menu like "Print report" of that application & also select printer from vb 6.0 )

  • Cisf May 11, 2010

    what are u really asking ? what u want to know ... ?



2 Answers

  • Level 2:

    An expert who has achieved level 2 by getting 100 points


    An expert that got 5 achievements.


    An expert who has written 50 answers of more than 400 characters.


    An expert who has answered 200 questions.

  • Expert
  • 202 Answers

Following are a handful things u have to know about VB file handling

for more details...go to

File Handling (Generic)

While VB is working on a better approach (FileSystemObject), the built-in file handling statements are still the only way to access data other than through the VB database capabilities. Your skills in this area can make or break your ability to work with various formats. The OPEN/CLOSE statements are critical to success, but the LOF, EOF, and LEN functions are used even more often! It's also a given that you'll use the DIR function regularly.
Dir - Returns a filename that matches a pattern
temp$ = Dir ("*.*")
CurDir - Returns the current directory
temp$ = CurDir
MkDir - Creates a directory
mkdir ( "newdirectoryname" )
ChDir - Changes the current directory to a new location
chdir ( "newdirectoryname" )
ChDrive - Changes the current drive
ChDirve "A"
RmDir - Removes the indicated directory
rmdir ( "directoryname" )
Freefile - Returns an unused file handle
i = freefile
Open - Opens a file for access, locking it from other applications
open "filename" for input as #1
Close - Closes a file so that other applications may access it
close #1
LOF - Returns the length of a file in bytes
i = lof ( #1 )
EOF - Returns a boolean value to indicate if the end of a file has been reached
statusvariable = eof ( #1 )
Name As - Renames a file
name "filename1" as "filename2"
Kill - Deletes a file
kill "filename"
Fileattr - Returns attribute information about a file
i = int ( tempvariable )
GetAttr - Returns attributes of a file or directory
i = GetAttr("c:\windows\temp")
SetAttr - Sets the attributes of a file
SetAttr pathname, vbHidden
Reset - Closes all disk files opened by the OPEN statement
FileDateTime - Returns data file was created or last edited
FileDateTime ( filename )
FileLen - Returns length of file in bytes
FileLen ( filename )
FileCopy - Copies a file to a new name
FileCopy sourcefile, destinationfile
Lock - Controls access to a part or all of a file opened by OPEN
Lock #1
UnLock - Restores access to a part or all of a file opended by OPEN
UnLock #1
Width # - Set the output line width used by the OPEN statement
Width #2, 80
File Handling - ASCII-specific

While VB is working on a better approach (FileSystemObject), the built-in file handling statements are still the only way to access data outside of a data base. Your skills in this area can make or break your ability to work with various formats. The OPEN/CLOSE statements are critical to success, but the LOF, EOF, and LEN functions are necessary to build useful code.
Line Input - Reads an entire line of ASCII text
line input #1, tempvariable$
Write - Puts data in a file, with separators for the data
write #1, tempvariable$
Print - Puts data in a file with no separators
print #1, tempvariable$
Spc - Used in a print statement to move a number of spaces
Print #2, var1; spc(15); var2
Tab - Used in a print statement to move to TAB locations
Print #2, var1; Tab(20); var2
File Handling - Binary-specific

VB also support features which allow you to access a file on a byte-by-byte basis. The good thing about it is that you have more control, the bad thing is that you may have to write more code. Generally, a programmer will use the option (ASCII or Binary access) according to the least code he has to write. For binary access the Get/Put are equivalent to the Line Input and Print functions used in ASCII text file access. The big difference between the two is that binary access will read (Get) an exact number of bytes of data, and the reading can start at any byte within the file.
Get - Reads data from a file
get #1, anyvariable
Put - Puts data into a file
put #1, anyvariable
Seek - Moves the current pointer to a defined location in a file
seek #1, 26
input #1, anyvariable
Loc - Returns current position with an open file
i = Loc(#2)

Posted on Jan 24, 2008

  • Chintu-KPV
    Chintu-KPV Jan 24, 2008

    Also try this link


  • Level 1:

    An expert who has achieved level 1.


    An expert that has over 10 points.


    An expert whose answer got voted for 2 times.

    Problem Solver:

    An expert who has answered 5 questions.

  • Contributor
  • 11 Answers

Not sure about the question.. mention ur need

Posted on Jan 24, 2008


1 Suggested Answer

  • 2 Answers

SOURCE: I have freestanding Series 8 dishwasher. Lately during the filling cycle water hammer is occurring. How can this be resolved

A 6ya expert can help you resolve that issue over the phone in a minute or two.
Best thing about this new service is that you are never placed on hold and get to talk to real repairmen in the US.
The service is completely free and covers almost anything you can think of (from cars to computers, handyman, and even drones).
click here to download the app (for users in the US for now) and get all the help you need.
Good luck!

Posted on Jan 02, 2017

Add Your Answer

Uploading: 0%


Complete. Click "Add" to insert your video. Add



Related Questions:

1 Answer

Can give an example of search command code?in visual basic 6.0

If you click on the following link you will find tutorial of Visual Basic and You will als so find example commands including some examples for parameter searches

hope it helpss rick

May 18, 2011 | Computers & Internet

2 Answers

How to download visual basic 6.0?

Go to write Microsoft visual basic 6.0 you will find torrent of it and can download with serial key.

If you like my solution than give me some rating.



Feb 07, 2011 | Microsoft Visual Basic 6.0 for PC

1 Answer

How to install microsoft visual basic 6.0

  • Open the Web page for Microsoft Visual Studio on your computer.
  • 2 Start the download by clicking the "Download" button. Put the file somewhere where you can find it easily, such as your desktop.
  • 3 Locate the setup file "vbrun60sp5.exe" on your hard drive.
  • 4 Double click the setup file to start the installation wizard.
  • 5 Read the license agreement and click the "accept" box to begin installation.
  • 6 Follow the instructions provided by the installation wizard to install the program.

  • Read more: How to Install Visual Basic 6 '

    Nov 27, 2010 | Microsoft Visual Basic 6.0 for PC

    1 Answer

    How to download microsoft visual basic 6.0


    Microsoft Visual basic is not a free download.

    The best complete application to program in Visual basic is Visual Studio. You can download it here: Visual Basic Downloads.

    If you want to download the service pack required to run VB applications see here:Download details: Visual Basic 6.0.

    See also:Microsoft Visual Basic 6.0 downloads.


    May 02, 2010 | Microsoft Visual Basic 6.0 for PC

    1 Answer

    Problem in Visual Basic 6.0 application

    You need to run your program in debug mode and step through the code one line at a time. Have a look at the values in your variables and see if they mach what you expect.

    This is one of the skills of a programmer. When things don't go as expected you need to be able to figure out what went wrong.

    If you don't have or can't use a debugger you can create a debug mode in your program perhaps with a command line variable or a value in a config file. When debug mode is turned on your program will output lots of information to a log file with details of module names and variable values. This is also useful if later on a user is having problems you can instruct them to turn on debug mode and send you the output.

    Hope this helps.

    Aug 24, 2009 | Microsoft Visual Basic 6.0 for PC

    1 Answer

    How to run matlab .m files from visual basic 6

    can you help me how to solve the videp basic problem in matlab?

    Jan 25, 2009 | Microsoft Visual Basic 6.0 for PC

    1 Answer

    Cannot install

    Hey,u need first to install that, IIS(Internet Information Service) component because this is web technology.

    Jan 14, 2009 | Microsoft Visual Basic Professional...

    2 Answers

    Where can i download software of the visual basic 6 for vista

    Hi there you can download the software from the Visual studio 6 on the Microsoft site.

    Sep 21, 2008 | Acer Aspire 5100 Notebook

    1 Answer


    here are some detailed infos:

    a) using an additional *.dll

    b) using a shell-command to winzip32.exe

    Apr 02, 2008 | Computers & Internet

    Not finding what you are looking for?
    Computers & Internet Logo

    Related Topics:

    3,168 people viewed this question

    Ask a Question

    Usually answered in minutes!

    Top Computers & Internet Experts

    Les Dickinson
    Les Dickinson

    Level 3 Expert

    18424 Answers

    Doctor PC
    Doctor PC

    Level 3 Expert

    7733 Answers

    David Payne
    David Payne

    Level 3 Expert

    14162 Answers

    Are you a Computer and Internet Expert? Answer questions, earn points and help others

    Answer questions

    Manuals & User Guides