|
-
Jul 10th, 2000, 11:55 AM
#1
Thread Starter
Frenzied Member
Ok I'm gonna make 2 exe's on the first one this is what its gonna do:
Code:
Private Sub Command1_Click()
Open "c:\a.dat" For Output As #1
Write #1, txtfn.Text, txtln.Text, txtcp.Text
Close #1
End Sub
then I got another EXE that tries to open C:\a.dat and put
the stuff I saved in three diffrent labels:
lblfn
lblln
lnlcp
can some one please tell me how to open it?
and put it in labels
thanks in advance
NXSupport - Your one-stop source for computer help
-
Jul 10th, 2000, 12:16 PM
#2
the property that relates to the text inside a label is:
Label2.Caption
do you want to overwrite the first file, or add to the end of it? If you want to add to the end, use the same method except change the word "Output" to "Append".
-
Jul 10th, 2000, 12:20 PM
#3
Thread Starter
Frenzied Member
I just want to save it in the first exe, and open it in the 2nd
basicly, nothing is written to the file from the 2nd exe
can you please give me the code? please cause I tryed diffrent ways of getting it to work, and no success
NXSupport - Your one-stop source for computer help
-
Jul 10th, 2000, 12:26 PM
#4
Here you go. Your second program should contain the following code. This example assumes you have three labels and a command button on the form.
Code:
Private Sub Command1_Click()
Dim strItem1 As String
Dim strItem2 As String
Dim strItem3 As String
Open "c:\a.dat" For Input As #1
Input #1, strItem1, strItem2, strItem3
Close #1
Label1.Caption = strItem1
Label2.Caption = strItem2
Label3.Caption = strItem3
End Sub
Note: The default property of a label is Caption, so the last 3 lines could be written as:
Label1 = strItem1
Label2 = strItem2
Label3 = strItem3
[Edited by BruceG on 07-10-2000 at 01:28 PM]
"It's cold gin time again ..."
Check out my website here.
-
Jul 10th, 2000, 12:28 PM
#5
_______
<?> give it a shot..see what happens
Code:
Private Sub Command2_Click()
dim intNum as integer
dim myVar1 as string, myVar2 as string, myVar3 as string
intnum = freefile
Open "c:\a.dat" For Input As intnum
input #1, myVar1, myVar2, myVar3
label1.caption = myVar1
label2.caption = myVar2
label3.caption = MyVar3
Close #intNum
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Jul 10th, 2000, 12:30 PM
#6
Thread Starter
Frenzied Member
Re: <?> give it a shot..see what happens
the stuff isn't numbers, to it woun't work Joe
NXSupport - Your one-stop source for computer help
-
Jul 10th, 2000, 12:37 PM
#7
Thread Starter
Frenzied Member
THANKS
NXSupport - Your one-stop source for computer help
-
Jul 10th, 2000, 12:38 PM
#8
who said it has to be numbers, and it does actually work.
Other people are sometimes right!
-
Jul 10th, 2000, 12:40 PM
#9
Thread Starter
Frenzied Member
ok, sorry, but bruces way worked, and he did spost it first, sorry
NXSupport - Your one-stop source for computer help
-
Jul 10th, 2000, 12:43 PM
#10
You're welcome, dimava.
FYI, dimava, Wayne (HeSaidJoe) was not wrong. He used the integer to declare a file handle to use with the Open statement, first by setting it to FreeFile, which is a built-in VB function that returns an integer representing a free (available) file handle. This variable is then used in the Open statement (... as #intnum) instead of a literal value (... as #1).
Wayne's technique is actually more professional, and is the technique I use for my professional apps.
See ya.
"It's cold gin time again ..."
Check out my website here.
-
Jul 10th, 2000, 12:46 PM
#11
_______
<?>
not a problem
...we are not in competition..
I was typing while his went through..if
it had been there I wouldn't have posted
since our code is basically the same..
except I use FreeFile which you should use
instead of numbers...Look it up...
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Jul 10th, 2000, 12:46 PM
#12
Thread Starter
Frenzied Member
ok, after I posted that I didn't need numbers, I reviewed the code again, and realized that I was wrong, because the first time I didn't look through the code carefully
NXSupport - Your one-stop source for computer help
-
Jul 10th, 2000, 12:48 PM
#13
_______
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
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
|