Newbie Here...Need Simple Code to Open txt file 
Author Message
 Newbie Here...Need Simple Code to Open txt file

I have only been working with VB for a week now and have worked thru all
the samples
ans stuff, so what  i want to do now is a simple program similar to
notepad.  All I want to do is use a CommonDialog control to open a txt
file.  I have the CommDialog control figured out, but from there I'm stuck.

My question:
What minimal controls do i need on page to put the txt file into
What code and where does the code go?

I know this is a simpl question, but we all start somewhere.........

Bob



Sun, 23 May 1999 03:00:00 GMT  
 Newbie Here...Need Simple Code to Open txt file

Robert,

If you have reached the point where you have successfully retrieved a
filename from the common dialog then you are most of the way home.

I assume you have a form with a textbox set to multiline mode on it
ready to receive the text from the file.  I am going to assume that
the filename you got from the coomon dialog is contained in

CommonDialog1.Filename as this is normally where it would be

To get the text to the text box ....

Open CommonDialog1.Filename for Input as #1
Input #1, TextBox , LOF(1)

This will grab the whole file and put it in the text box

Quote:

>I have only been working with VB for a week now and have worked thru all
>the samples
>ans stuff, so what  i want to do now is a simple program similar to
>notepad.  All I want to do is use a CommonDialog control to open a txt
>file.  I have the CommDialog control figured out, but from there I'm stuck.
>My question:
>What minimal controls do i need on page to put the txt file into
>What code and where does the code go?
>I know this is a simpl question, but we all start somewhere.........
>Bob


A mind which has been expanded by a new idea,
never returns to it's original dimensions.


Sun, 23 May 1999 03:00:00 GMT  
 Newbie Here...Need Simple Code to Open txt file



Quote:
>I have only been working with VB for a week now and have worked thru all
>the samples
>ans stuff, so what  i want to do now is a simple program similar to
>notepad.  All I want to do is use a CommonDialog control to open a txt
>file.  I have the CommDialog control figured out, but from there I'm stuck.

>My question:
>What minimal controls do i need on page to put the txt file into
>What code and where does the code go?

>I know this is a simpl question, but we all start somewhere.........

Start by putting a big textbox on the form.  Set it to be multiline with
horizontal and vertical scrollbars, all at design time.

Then create a menu, (See menu in Help) starting with File/Load and
File/Save.  When you have done this you will find that VB has created a
couple of empty subroutines, Load and Save, which you can put your code
into.  That should do to be going on with!  Come back if you're stuck.
--
Peter Hesketh, Mynyddbach, Gwent, UK
"Pas de lieu Rhone que nous",  Sam Lloyd



Sun, 23 May 1999 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Newbie - Open a txt file

2. Newbie: Simple file routine help needed.

3. Need code for simple read of text file with columns of numbers

4. Newbie needs help with an open file

5. File transfer from URL.....newbie code mod needed

6. SIMPLE QUESTION 1 OF 2 PRINTING A .TXT FILE

7. SIMPLE QUESTION 1 OF 2 PRINTING A .TXT FILE

8. Adding .TXT files to a VB program without the .TXT file

9. I need help to convert TXT file(s) to TIF file(s)

10. Newbie - txt files into combo box

11. NEWBIE, URGENT:Please Help : Importing TabDelim txt file into Access Database

12. Newbie question 2: printing .txt files

 

 
Powered by phpBB® Forum Software