AllExperts > Experts 
Search      

Visual Basic

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More Visual Basic Answers
Question Library

Ask a question about Visual Basic
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Ravindra
Expertise
visual basic application programming from design to access information, sql, engineering and commercial applications. access databases, excel. Optional: 1) if you want me to spend quality time and do special work, i expect to be paid a reasonable price for my time. 2) if you are pleased with my reply you could consider a donation of 1$. 3) you can visit my website http://ravindra.coolpage.biz (under constrn)

Experience

Past/Present clients
project work for a Norway company, and a Canadian company completed. Freelance Project work and Teaching
teaching vb

 
   

You are here:  Experts > Computing/Technology > Basic > Visual Basic > Visual Basic, Opening a file to a multi-line txt field through a FilelistBox

Topic: Visual Basic



Expert: Ravindra
Date: 6/27/2008
Subject: Visual Basic, Opening a file to a multi-line txt field through a FilelistBox

Question
Hello,
I'm writing a program to help edit a specific .ini file for a program to help newcomers out. What I currently have is a button that says "Locate your ini file for editing", after clicking, a makeshift "Open" dialog box pops up, consisting of a drivelistbox, a directorylistbox, and a filelistbox, who all work together. The problem is, I want to know how I can take the selected file from the file list box (after hitting the "OK" button I've created) and take it from that Open dialog box, to a new form consisting of a multi-line text field to be ready for input. Then, after hitting "Finalize", automatically overwrite that file with the users new settings.

If you can help, that'd be great!

-Aaron

Answer
store the path of the selected text file to a variable and use the shell command to open the same.

sample code:
to open notepad
Option Explicit
Dim adu As String
Private Sub Command1_Click()
adu = "notepad"
Shell adu, vbNormalFocus
End Sub
' notepad should be in c: otherwise specify the path to notepad.exe

to make the notepad open a particular file:

Dim pa As String, pat1 As String, pat2 As String

pat1 = "notepad "

pat2 = "C:\my documents\goobe_acc.txt"
'CHANGE THIS LINE TO THE VARIABLE OBTAINED FROM FILELISTBOX & PATH
pa = pat1 & pat2

Shell pa, vbNormalFocus

Ravindra M.G.

Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.