Basic VB Function

Im very new to VB and I would like some help on something im doing that I have to do in a hurry..
I would like to set up two buttons
the first on click event should simply run a file ie an *.exe

The second button should display in my my List box ="INFO" the contents of a text file in a particular location that I can specify ...

Can you help me with how I can go about doing such a program
Thanks in advance
LVL 1
michaeldiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mcriderCommented:
First part:

Shell "Programname.exe",vbNormalFocus

Second part I'm not sure I understand... Are you trying to show the contents of a file in a listbox??  You should be using a textbox...


Cheers!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
michaeldiAuthor Commented:
Yes I dont mind how it display so when I click on the button the TEXTBOX will show text of a specfied file..
0
VbmasterCommented:
Try this function, it reads text from a file. just set the Textbox.Text = InputFile(filename)

Function InputFile(Filename As String) As String

  Dim Filenr As Long
 
  Filenr = FreeFile
  Open Filename For Input Lock Read As Filenr
  InputFile = Input$(LOF(Filenr), Filenr)
  Close Filenr

End Function

0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

michaeldiAuthor Commented:
Can you just confirm which parts I do actually have to change because I cant seem to get it working: ive tried all sorts and im no nearer
heres where im at: thanks

THE BUTTON

Private Sub Command6_Click()
TextDisplay.Text = C:Y2K (FileName)
End Sub



THE MODULE

Function InputFile(FileName As String) As String

  Dim Filenr As Long
   
  Filenr = FreeFile
  Open FileName For Input Lock Read As Filenr
  InputFile = Input$(LOF(Filenr), Filenr)
  Close Filenr

End Function

EXTRAS
My file name is "C:Y2K.TXT"
my Textbox name is "TextDisplay"
0
VbmasterCommented:
How do you get that it's supposed to be "C:Y2K (FileName) " from my comment? ;)

Replace the line

TextDisplay.Text = C:Y2K (FileName)

with

TextDisplay.Text = InputFile("C:\Y2K.TXT")

0
michaeldiAuthor Commented:
thnak to both of you I willshare the points for
thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.