|
-
Aug 2nd, 2000, 12:44 PM
#1
Thread Starter
Hyperactive Member
Print 1#, "Errrrrrrrr"
Why doesn't this work
Code:
Print #1, Text1 & "Blah" & Text2
It just prints "text1" in the document, and doesn't print the text in Text one...why?
-
Aug 2nd, 2000, 12:52 PM
#2
Fanatic Member
Did you open it for Output?
This works for me
Code:
Open "C:\windows\desktop\test.txt" For Output As #1
Print #1, Text1 & "Blah" & Text2
Close #1
What do you have in Text1? As default it is always "Text1" for TextBox1, "Text2" for TextBox2 and so on. Are you suru that you are changing the contest of the textbox?
[Edited by QWERTY on 08-02-2000 at 01:55 PM]
-
Aug 2nd, 2000, 01:23 PM
#3
If it printed "Text1", you probably had quotes around it.
-
Aug 2nd, 2000, 01:44 PM
#4
Member
Is Text1 a textbox? If it is you have to use Text1.Text. Same goes for Text2 if that is also a textbox.
-
Aug 2nd, 2000, 01:46 PM
#5
Text is the default property for a TextBox, hence you can omit it.
-
Aug 2nd, 2000, 02:41 PM
#6
Member
-
Aug 2nd, 2000, 03:15 PM
#7
transcendental analytic
Use option explicit, and it will notice you about undefined variables
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Aug 2nd, 2000, 08:49 PM
#8
Thread Starter
Hyperactive Member
Well...Im having trouble making the correct format for it... so here is what I am trying to do...
I want the program to print this vb command into the text file..
Code:
MsgBox "Their message from Text1", vbCritical, "Their title from the Text2"
-
Aug 2nd, 2000, 09:00 PM
#9
_______
<?>
Code:
Private Sub Command1_Click()
Dim strOne As String, strTwo As String
strOne = Text1.Text
strTwo = Text2.Text
MsgBox strOne, vbCritical, strTwo
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
-
Aug 2nd, 2000, 09:06 PM
#10
Thread Starter
Hyperactive Member
Not quite...im trying to save it into a text file...
-
Aug 2nd, 2000, 09:23 PM
#11
_______
<?>
what exactly do you want to save
the msgbox line itself or the variables that are
used in it.
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Aug 2nd, 2000, 09:28 PM
#12
_______
<?>...like this..
Code:
Private Sub Command1_Click()
Dim strOne As String, strTwo As String
strOne = Text1.Text
strTwo = Text2.Text
Open "c:\my documents\try.txt" For Output As #1
Print #1, strOne
Print #1, strTwo
Close #1
Open "c:\my documents\try.txt" For Input As #1
Input #1, strOne, strTwo
Close #1
MsgBox strOne, vbCritical, strTwo
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
-
Aug 2nd, 2000, 09:33 PM
#13
Thread Starter
Hyperactive Member
but that just prints what they typed in the textbox...I want it to print the whole command i mentioned above...
-
Aug 2nd, 2000, 09:43 PM
#14
Thread Starter
Hyperactive Member
I want to save this exact line into a txt file
MsgBox "Their message from Text1", vbCritical, "Their title from the Text2"
but...the messages would be Text1 and Text2 instead of what I put for the text...
-
Aug 2nd, 2000, 09:56 PM
#15
Code:
Open "C:\myfile.txt" For Output As #1
Print #1, Text1.text & vbCritical & Text2.text
Close #1
That should work..for whatever you are trying to do.
Or are you trying to space it maybe?
Code:
Open "C:\myfile.txt" For Output As #1
Print #1, Text1.text & Chr$(13) & Chr$(10) & Text2.text
Close #1
What the...are you trying to do?
[Edited by Matthew Gates on 08-02-2000 at 11:01 PM]
-
Aug 2nd, 2000, 10:11 PM
#16
Thread Starter
Hyperactive Member
You guys are forgetting the MsgBox part...
Code:
dlgMain.Flags = &H1000
dlgMain.DialogTitle = "Open"
dlgMain.Filter = "txt Files (*.txt)|*.txt|"
dlgMain.CancelError = False
dlgMain.ShowSave
If Len(dlgMain.FileName) > 0 Then
strFileName = dlgMain.FileName
Me.Caption = "Program - [" & dlgMain.FileTitle & "]"
Open dlgMain.FileTitle For Output As #1
If Option1.Value = True Then
'HERE
Print #1, "MsgBox " & """ & text1 & """ & ", vbCritical, " & """ & Text2 & """
Close #1
Else
End If
I want that to write
MsgBox "Their message from Text1", vbCritical, "Their title from the Text2"
into a text file...
-
Aug 2nd, 2000, 10:22 PM
#17
Code:
Open "C:\Windows\Desktop\myfile.txt" For Output As #1
Print #1, "Msgbox " & Text1.Text & ", vbCritical, " & Text2.Text
Close #1
How's that? That should do the trick.
-
Aug 2nd, 2000, 10:29 PM
#18
Thread Starter
Hyperactive Member
allright..i used that to get it...
Code:
Private Sub Command1_Click()
Open "C:\Windows\Desktop\myfile.txt" For Output As #1
Print #1, "Msgbox " & """" & Text1.Text & """" & ", vbCritical, " & """" & Text2.Text & """"
Close #1
End Sub
That finished it off...thanks all
-
Aug 2nd, 2000, 10:38 PM
#19
Anyway, instead of using """", you should use Chr$(34) instead. That'll put the quotes around what you say. So instead of all that, you have:
Code:
Open "C:\Windows\Desktop\myfile.txt" For Output As #1
Print #1, "Msgbox " & Chr$(34) & Text1.Text & Chr$(34) & ", vbCritical, " & Chr$(34) & Text2.Text & Chr$(34)
Close #1
-
Aug 3rd, 2000, 04:28 AM
#20
transcendental analytic
what a mess
Code:
Print #1, "Msgbox """ & Text1.Text & """, vbCritical, """ & Text2.Text & """"
two "" inside string quotes means a "
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
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
|