It works. Let me see your code. You will not get answers with that attitude. If you look at the text file your data will be there. If you need to retrieve the data you will need to add the code for that.
As I have said numerous times, This will get you on the right path. I am not here to do your work for you.
Do you Know about the different ways to Open
a file, ie... Append, Read, Write, and so on?
I would not worry about a Common Dialog Box, and how to
pass strings & values to and from it, until I had the code to
do the actual reading and writeing accomplished.
MyFileNum = freefile 'Look Up FreeFile
Open "C:\temp.text" for OutPut as #MyFileNum 'Look Up Open, Output
Print #MyFileNum, "This is the First Line"
Print #MyFileNum, "This is the Second Line"
Close #MyFileNum
MyFileNum = freefile
open "c:\temp.text" for input as #MyFileNum
While Not EOF(MyFileNum)
Line Input #MyFileNum, X$ 'Look up Line Input
msgbox X$
wend
close #MyFileNum
msgbox "All Done"
-The above is for illustration purpose
-Hop this Helps
-Lou
i know append and so on and thnx for that last piece of code but now i still don't have my question answered there is no file created but here's my code could someone please tell me the changes i have to make
Private Sub mnusave_Click(Index As Integer)
str(0) = txtZoon.Text
str(1) = txtDochter.Text
str(2) = txtVader1.Text
CMDialog1.ShowSave
CMDialog1.FileName = txtringnummer.Text
If CMDialog1.CancelError Then End Sub
Open App.Path & "\words.txt" For Output As #1
'Then save the strings to the file:
Write #1, str(0), str(1), str(2)
Close #1
End Sub
Private Sub mnuOpen_Click(Index As Integer)
'Clear the textboxes:
txtZoon.Text = ""
txtDochter.Text = ""
txtVader1.Text = ""
CMDialog1.ShowOpen
Open App.Path & "\words.txt" For Input As #1
Input #1, str(0), str(1), str(2)
'Then set them to the textboxes
If CMDialog1.CancelError Then End Sub
I don't get why your using the common dialog to show the open box, the code you have has nothing to do with the common dialog, your opening something regardless of what you pick in the common-dialog box. if you want to link it to the common dialog you should use code like
with commondialog1
.filter "text files|*.txt"
.showopen
end with
'im sorta new so you have to put your own code in here
'that would split up the text file into your different parts
'probably use the Len command, and assign each different
'part to each text-box
[/end vb code]
sorry if that wasn't what you wanted i tried at least... now can i gutter the thread since i took my time to post in it??
Government is another way to say better…than…you.
It’s like ice but no pick, a murder charge that won’t stick,
it’s like a whole other world where you can smell the food,
but you can’t touch the silverware.
Huh, what luck. Fascism you can vote for.
Humph, isn’t that sweet?
And we’re all gonna die some day, because that’s the American way
-Stone Sour
can anyone help me i need to save multiple text boxes to 1 file and i want to use an dialogbox or something else so the user can decide where to save the file my code is posted above but in that state their is no file created this is going for a week now will someone please come up with some answers??????
here is a sample i made that does what you want... i think
the design is very crude, but i just made it in like 10 mins just to see if i could do it
Last edited by Skitchen8; Jul 2nd, 2001 at 02:32 PM.
Government is another way to say better…than…you.
It’s like ice but no pick, a murder charge that won’t stick,
it’s like a whole other world where you can smell the food,
but you can’t touch the silverware.
Huh, what luck. Fascism you can vote for.
Humph, isn’t that sweet?
And we’re all gonna die some day, because that’s the American way
-Stone Sour
yea... i waz mad at my bro and hes like 3 so thats all i can call him so i used it as the variable name, did you get it to work all right, and do what you wanted??
Government is another way to say better…than…you.
It’s like ice but no pick, a murder charge that won’t stick,
it’s like a whole other world where you can smell the food,
but you can’t touch the silverware.
Huh, what luck. Fascism you can vote for.
Humph, isn’t that sweet?
And we’re all gonna die some day, because that’s the American way
-Stone Sour
OK I have been gone, I see you are still stuck on this.
This is a BRIEF explantion on the Common Dialog Box.
(Although I don't see why you need to use it)
Use the save as dialog.
Put a CommonDialog control on the form and use the following code:
code:--------------------------------------------------------------------------------
Private Sub button_Click()
Dim iFileNum As Integer
Dim sFileName As String
With CommonDialog1
.CancelError = True
.DefExt = "txt"
.Filter = "Text files|*.txt|All files|*.*"
'the above properties can be set during design time
.Flags = cdlOFNPathMustExist + cldOFNHideReadOnly + cdlOFNOverwritePrompt
On Error Resume Next
.ShowSave
If Err = cdlCancel Then
'the user click on the cancel button so bail out
Exit Sub
End If
sFileName = .Filename
End With
iFileNum = FreeFile
Open sFileName For Output As iFileNum
Print #iFileNum, form.textbox.Text
Close iFileNum
basic.Text = form.textbox.Text
End Sub
Now, before you go and plug this code into your module, it will not work. I did not use your naming conventions. You will need to set the Filters and Flags yourself. I don't see why you need this, because your application saves to a specific file. Unless you want to save multiple files (in which a database may be in order). Read up on the Flags and Filters for the common dialog box. As your code stands now it will open and read the file, it will erase and re write the file, then pull it's data into the GUI.
I think that we did just fine doing our codes, so stop bein a little butthole!! LOL
Government is another way to say better…than…you.
It’s like ice but no pick, a murder charge that won’t stick,
it’s like a whole other world where you can smell the food,
but you can’t touch the silverware.
Huh, what luck. Fascism you can vote for.
Humph, isn’t that sweet?
And we’re all gonna die some day, because that’s the American way
-Stone Sour
It was no problem, im happy that you posted this, because i basically taught myself how to do that only because i had to so thank you
don't tell that to parksie... he'lll want you to bend over and pick up the soap
Government is another way to say better…than…you.
It’s like ice but no pick, a murder charge that won’t stick,
it’s like a whole other world where you can smell the food,
but you can’t touch the silverware.
Huh, what luck. Fascism you can vote for.
Humph, isn’t that sweet?
And we’re all gonna die some day, because that’s the American way
-Stone Sour
Government is another way to say better…than…you.
It’s like ice but no pick, a murder charge that won’t stick,
it’s like a whole other world where you can smell the food,
but you can’t touch the silverware.
Huh, what luck. Fascism you can vote for.
Humph, isn’t that sweet?
And we’re all gonna die some day, because that’s the American way
-Stone Sour
Originally posted by Robke
If CMDialog1.CancelError Then End Sub
I get a syntax error at the End Sub. Any Ideas?
[My Code:]
Private Sub mnuOpen_Click(Index As Integer)
CommonDialog1.ShowOpen
If CommonDialog1.CancelError Then End Sub
Open openpath For Input As #1
stext = Input(LOF(1), 1)
Close #1
RichTextBox1.Text = stext
End Sub