|
-
Jan 15th, 2004, 04:52 AM
#1
Thread Starter
New Member
Text file
hi, Shouldn't this open a *.txt -file?
(because it doesn't..)
Private Sub Code_Click()
Dim filnummer As Integer
Dim filnavn As String
'Unikt filnummer findes
filnummer = FreeFile
filnavn = "C:\Documents and Settings\whiteraven\Dokumenter\game\Code.txt"
Open filnavn For Input As #filnummer
Close #filnummer
End Sub
-
Jan 15th, 2004, 04:54 AM
#2
Re: Text file
Originally posted by whiteraven
hi, Shouldn't this open a *.txt -file?
(because it doesn't..)
Private Sub Code_Click()
Dim filnummer As Integer
Dim filnavn As String
'Unikt filnummer findes
filnummer = FreeFile
filnavn = "C:\Documents and Settings\whiteraven\Dokumenter\game\Code.txt"
Open filnavn For Input As #filnummer
Close #filnummer
End Sub
You are opening it. For the app, that is. You can't see it. Then you're closing it.
-
Jan 15th, 2004, 04:56 AM
#3
Are you looking to shell the file so that you can visibly see it?
-
Jan 15th, 2004, 04:56 AM
#4
Thread Starter
New Member
okay, I kinda thought so.. Isn't there a way to make it open the .txt -file so that it comes visible?
-
Jan 15th, 2004, 05:01 AM
#5
Thread Starter
New Member
I just wan't to make it open the .txt -file so that I can see it. I don't know why, but I just thought that would be really cool.. hehe
-
Jan 15th, 2004, 05:03 AM
#6
-= B u g S l a y e r =-
VB Code:
'Make a new project. To the form add a CommonDialog control, a text box and a command button.
'Code:
Option Explicit
Private Sub Command1_Click()
Dim FileName As String
Dim F As Integer
CommonDialog1.ShowOpen
FileName = CommonDialog1.FileName
F = FreeFile
Open FileName For Input As #F
Text1.Text = Input$(LOF(F), F)
Close #F
End Sub
-
Jan 15th, 2004, 05:04 AM
#7
Thread Starter
New Member
Thx! I'll try that, damn this forum rox!
-
Jan 15th, 2004, 05:05 AM
#8
Originally posted by peet
VB Code:
'Make a new project. To the form add a CommonDialog control, a text box and a command button.
'Code:
Option Explicit
Private Sub Command1_Click()
Dim FileName As String
Dim F As Integer
CommonDialog1.ShowOpen
FileName = CommonDialog1.FileName
F = FreeFile
Open FileName For Input As #F
Text1.Text = Input$(LOF(F), F)
Close #F
End Sub
And here's YOUR sign! 
(Woohoo!)
Here's how you would shellexecute the .txt file to display it:
VB Code:
'General Section
Private Declare Function ShellExecute Lib "shell32.dll" Alias _
"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation _
As String, ByVal lpFile As String, ByVal lpParameters _
As String, ByVal lpDirectory As String, ByVal nShowCmd _
As Long) As Long
'in the form code
Call ShellExecute(Me.hwnd, "Open", "C:\file.txt", "", "c:\", 1)
-
Jan 15th, 2004, 05:24 AM
#9
Thread Starter
New Member
It works now!
It look really cool, it was for a small game that I made in VB. The "Beta-tester's" should be able to view the code.. Hehe, it was an "3-in-a-row"-game.. Thx for all the help from U guys! C ya!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|