English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I would like to have a text file (or any file for that matter) be open on click of a menu option. That text file is in the project because i created it when i was in "as a new item"
Can anyone help

2006-08-24 16:09:29 · 3 answers · asked by stepanstas 2 in Computers & Internet Programming & Design

3 answers

So, what are you having difficulty with, the menu event or opening files?

What's in the file?
------------- Edit 25-Aug

Ok, I got your note. I think you can start with something like this. Also, while you are in the .NET IDE, hit F2 to get the object browser. Search for things like "Open" and "File" to find functions related file io. Here are some UN-tested examples I wrote.

Sorry about the crazy formatting, it's Yahoo doing that. I'll send it via email.

Dim MyString As String = Nothing

'To read everything into MyString
MyString = System.IO.File.ReadAllText ( "Myfile.txt")

'To read all records into MyString
Microsoft.VisualBasic.FileOpen (1, "MyFile.txt", _ &
OpenMode.Input, OpenAccess.Read, OpenShare.Default)

Do Until Microsoft.VisualBasic.EOF(1)
Microsoft.VisualBasic.Input(1, MyString)
Debug.WriteLine(MyString)
Loop

2006-08-24 16:21:03 · answer #1 · answered by Anonymous · 0 0

Use the mnuItem_Click event. After you set up your menu, and give your menu item a name, such as mnuFileOpen, you can find the mnuFileOpen_Click event, and put there the code you need to open your text file.

2006-08-24 23:16:21 · answer #2 · answered by ? 6 · 0 1

what chapter are u on? I have a hangman solution that i can send you, maybe it can help

2006-08-24 23:17:02 · answer #3 · answered by chris 1 · 0 1

fedest.com, questions and answers