Log inUsernamePassword
Log me on automatically each visit    
Register
Register
Log in to check your private messages
Log in to check your private messages
Visual Basic Forum for Visual Basic Programmers VB Forum Index » Registry & File Input / Output

Post new topic   Reply to topic
open files?
View previous topic :: View next topic  
Author Message
alexltkv
Regular


Joined: 08 Jul 2005
Posts: 61
Location: Iraq

PostPosted: Jul 11th, 2005 08:44 AM    Post subject: open files? Reply with quote

I'm new at VB and I would like to know the code for opening files and documents. Stuff like MY MUSIC, MY PICTURES, ect...
Back to top
View user's profile Send private message
RoofRabbit
Regular


Joined: 06 Jul 2005
Posts: 95
Location: Lenoir, NC USA

PostPosted: Jul 11th, 2005 07:38 PM    Post subject: Re: open files? Reply with quote

alexltkv wrote:
Stuff like MY MUSIC, MY PICTURES, ect...


Those are directories, not files. However, you can find basic file I/O in the vb section on my site as well as many other places on the net.
_________________
Website - [link]
Back to top
View user's profile Send private message Visit poster's website ICQ Number
GreenEye
Newbie


Joined: 20 Aug 2005
Posts: 1

PostPosted: Aug 20th, 2005 01:23 PM    Post subject: Reply with quote

Here is code to open a file and read it into TextBox. Place a text-box Text1 on the form and a cammand button Command1. Now cut paste this code :

Code:
Private Sub Command1_Click()
Open "C:\autoexec.bat" For Input As #1
    Text1.Text = Input(LOF(1), #1)
Close #1
End Sub


This opens "C:\autoexec.bat" and displays its contents in TextBox.

Hope this is enough to get you started.
Back to top
View user's profile Send private message
VB_Developer
Newbie


Joined: 25 Feb 2006
Posts: 18
Location: Hyderabad, India

PostPosted: Feb 26th, 2006 09:08 AM    Post subject: Reply with quote

Hi,
You can also make use of the Microsoft Runtime Scripting library to play with files and folders.

Quote:

Go to Preferences in the Project menu, select the Microsoft Runtime Scripting.

go to ur code, create a File System Object

dim fs as fileSystemObject.



Hope this will help you in togling with files and folders.

Thanks
Back to top
View user's profile Send private message
saheb_vb
Newbie


Joined: 10 May 2006
Posts: 2

PostPosted: Jun 6th, 2006 01:13 AM    Post subject: Reply with quote

The code :
Private Sub Command1_Click()
Open "C:\autoexec.bat" For Input As #1
Text1.Text = Input(LOF(1), #1)
Close #1
End Sub

does not work..Sad
Back to top
View user's profile Send private message Send e-mail
P.T.A.M.
Administrator


Joined: 08 Oct 2003
Posts: 752
Location: Greece

PostPosted: Jun 6th, 2006 06:32 AM    Post subject: Reply with quote

saheb_vb wrote:
The code :
Private Sub Command1_Click()
Open "C:\autoexec.bat" For Input As #1
Text1.Text = Input(LOF(1), #1)
Close #1
End Sub

does not work..Sad


What happens? Nothing? Does an error occur?
_________________
No one is completely useless. They can at least be an example of what to avoid.
Back to top
View user's profile Send private message Send e-mail Visit poster's website ICQ Number
Display posts from previous:   
Post new topic   Reply to topic    Visual Basic Forum for Visual Basic Programmers VB Forum Index » Registry & File Input / Output All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Visual Basic Forum runs phpBB | Forum Template © iOptional
VB Resources | SSL | Visual Basic