|
-
May 12th, 2009, 06:05 PM
#1
Thread Starter
Banned
How do I prompt the user where to save thier file? (In this case .txt)
I wanted to know how my users can write something in a textbox, then allow them to save it as a .txt file.
Last edited by sn3akyr4bb1t; May 12th, 2009 at 08:33 PM.
Reason: edit
-
May 12th, 2009, 06:11 PM
#2
Re: How can I add a "Save" button on my form?
How far have you got so far?
Show us your code and we can give you some pointers.
-
May 12th, 2009, 06:13 PM
#3
Thread Starter
Banned
Re: How can I add a "Save" button on my form?
I made a form, with just a TextBox. I want my users to type something like "Hello" and be able to save it as a .txt file anywhere on there pc.
-
May 12th, 2009, 06:14 PM
#4
Re: How can I add a "Save" button on my form?
I mean what have you found out about saving text files so far?
-
May 12th, 2009, 06:18 PM
#5
Thread Starter
Banned
Re: How can I add a "Save" button on my form?
I found the "SaveFileDialog" in the ToolBox, but I don't know the codes.
-
May 12th, 2009, 06:18 PM
#6
Re: How can I add a "Save" button on my form?
-
May 12th, 2009, 06:23 PM
#7
Thread Starter
Banned
Re: How can I add a "Save" button on my form?
 Originally Posted by Vectris
google before you post
I did, found nothing.
-
May 12th, 2009, 06:24 PM
#8
Re: How can I add a "Save" button on my form?
 Originally Posted by sn3akyr4bb1t
I found the "SaveFileDialog" in the ToolBox, but I don't know the codes.
All the SaveFileDialog does is allows the user to browse for the folder and set the filename they want you to use for saving the file.
You need to write your own code to save the file.
As Vectris said - try googling "save text file vb.net" and you will find thousands upon thousands of examples of how to do this.
-
May 12th, 2009, 06:25 PM
#9
Re: How can I add a "Save" button on my form?
 Originally Posted by sn3akyr4bb1t
I did, found nothing.
I find that amazingly hard to believe. I got over 1.3 million pages returned by my google query.
-
May 12th, 2009, 06:34 PM
#10
Thread Starter
Banned
Re: How can I add a "Save" button on my form?
Ok, will did this ever come to your mind that maybe our keywords were different?
-
May 12th, 2009, 06:34 PM
#11
Thread Starter
Banned
Re: How can I add a "Save" button on my form?
 Originally Posted by keystone_paul
All the SaveFileDialog does is allows the user to browse for the folder and set the filename they want you to use for saving the file.
You need to write your own code to save the file.
As Vectris said - try googling "save text file vb.net" and you will find thousands upon thousands of examples of how to do this.
I will try again.
-
May 12th, 2009, 06:35 PM
#12
Thread Starter
Banned
Re: How can I add a "Save" button on my form?
Guys need to go somewhere, be back in like 1 hour as of this post.
-
May 12th, 2009, 06:42 PM
#13
Re: How can I add a "Save" button on my form?
 Originally Posted by sn3akyr4bb1t
Ok, will did this ever come to your mind that maybe our keywords were different?
If you seriously didn't get anything back because our keywords were wildly different perhaps you need to think more deeply about how you phrase your questions.
For example the title of this topic is "How can I add a 'Save' button on my form?"
The answer to that is really simple - open your form, click on the button icon on the toolbox and click on the form and draw a button of the required size and set the button's text and name to reflect the fact it is a save button.
Your actual question is really "how do I write a text file" (and possibly also "how do I prompt the user where to save his file").
I'm not trying to be sarcastic or unhelpful but you need to be able to understand what the root of your question is or you'll never get anywhere.
-
May 12th, 2009, 08:32 PM
#14
Thread Starter
Banned
Re: How can I add a "Save" button on my form?
 Originally Posted by keystone_paul
If you seriously didn't get anything back because our keywords were wildly different perhaps you need to think more deeply about how you phrase your questions.
For example the title of this topic is "How can I add a 'Save' button on my form?"
The answer to that is really simple - open your form, click on the button icon on the toolbox and click on the form and draw a button of the required size and set the button's text and name to reflect the fact it is a save button.
Your actual question is really "how do I write a text file" (and possibly also "how do I prompt the user where to save his file").
I'm not trying to be sarcastic or unhelpful but you need to be able to understand what the root of your question is or you'll never get anywhere.
Ok, I will rename my post. (By the way, almost everyone here talks to me either sarcastic or unhelpful)
-
May 12th, 2009, 08:42 PM
#15
Re: How do I prompt the user where to save thier file? (In this case .txt)
 Originally Posted by sn3akyr4bb1t
(By the way, almost everyone here talks to me either sarcastic or unhelpful)
Is it really such a mystery why?
-
May 12th, 2009, 08:52 PM
#16
Thread Starter
Banned
Re: How do I prompt the user where to save thier file? (In this case .txt)
 Originally Posted by ForumAccount
Is it really such a mystery why?
What were you thinking before you just made that post? Do you think that what you just said helped me prompt a user where to save their file? Think about it.
-
May 12th, 2009, 10:52 PM
#17
Re: How do I prompt the user where to save thier file? (In this case .txt)
I think ForumAccount's post was supposed to prompt you to think about why apparently everyone responds to your questions with sarcasm. I can tell you that it's because you seem to make very little effort to find information for yourself and even when people do provide instructions you make no effort to follow them. You appear to just want other people to write your code for you. People who have worked hard to learn what they know often enjoy sharing it with others who are also prepared to work hard. They are generally not so keen to share with those who won't make a similar effort for themselves.
You said in post #5 that you know about the SaveFileDialog. I just went to Google and entered savefiledialog. The very first match was the MSDN documentation for the SaveFileDialog class, which contains this code example:
vb.net Code:
Private Sub button1_Click(sender As Object, e As System.EventArgs) Dim myStream As Stream Dim saveFileDialog1 As New SaveFileDialog() saveFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*" saveFileDialog1.FilterIndex = 2 saveFileDialog1.RestoreDirectory = True If saveFileDialog1.ShowDialog() = DialogResult.OK Then myStream = saveFileDialog1.OpenFile() If (myStream IsNot Nothing) Then ' Code to write the stream goes here. myStream.Close() End If End If End Sub
If you didn't find that yourself then you didn't try. If you don't try then very few people here will be keen to help you.
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
|