| | |
Saving a file: Default Extension, Name & Folder
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Aug 2009
Posts: 5
Reputation:
Solved Threads: 0
Hello, i am currently developing a new OpenSource project.
I will release it to the public this week. :-)
Let's get to my question(s) then:
I lack knowledge in saving files on VB.NET, any help would be greatly appreciated and a great boost on my project.
I will release it to the public this week. :-)
Let's get to my question(s) then:
- I have a Rich Text Box, and i want to save that text into a default extension.
- I want the default name to be found in the textbox, E.g: Hello my name is Zack (The file would appear as default name Zack on the Save File Dialog, but if the name was Richards, it would appear Richards instead).
- Also, the Save File Dialog should open a default folder. (.../Saved)
I lack knowledge in saving files on VB.NET, any help would be greatly appreciated and a great boost on my project.
•
•
Join Date: Jun 2009
Posts: 269
Reputation:
Solved Threads: 54
Add a savefiledialog (here sfd) to your form
the following code you add into your save click event
and the next code you just add to your code
the following code you add into your save click event
vb Syntax (Toggle Plain Text)
With sfd .FileName = stri.Replace("Hello my name is ", "") & ".rtf" .InitialDirectory = My.Application.Info.DirectoryPath & "/Saved/" .ShowDialog() End With
and the next code you just add to your code
vb Syntax (Toggle Plain Text)
Private Sub sfd_FileOk(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles sfd.FileOk RichTextBox1.SaveFile(sfd.FileName, RichTextBoxStreamType.RichText) End Sub
Last edited by GeekByChoiCe; Aug 12th, 2009 at 2:26 am. Reason: bb codes :@
•
•
Join Date: Aug 2009
Posts: 20
Reputation:
Solved Threads: 0
very good
Free Ads USA and Canada Textlink and Classifieds | Post Your Ads | Post Classifieds Ads | Free Sell or Buy Domains
Publish without Approval!
Publish without Approval!
•
•
Join Date: Aug 2009
Posts: 5
Reputation:
Solved Threads: 0
Thanks, this is almost solved.
The problem is:
The problem is:
- if there is a large text in the textbox, i would like to delete it from the filename, only getting the "my name is Zack" part, therefore making it possible to write a whole text and it finds "my name is Zack" somewhere, and gets Zack as filename (Zack has example, could be Richards or anything else.
•
•
Join Date: Jun 2009
Posts: 269
Reputation:
Solved Threads: 54
Thats pretty hard if the text is always different. A simple solution would be that you force the user to write their name into a sepearate textbox so you can use that as the file name.
If you want to stick to the solution you already have then it will be pretty hard because you never know where the name is and users normally never stick to the syntax, so you cant trust them that they will always write "hello my name is blabla"
If you want to stick to the solution you already have then it will be pretty hard because you never know where the name is and users normally never stick to the syntax, so you cant trust them that they will always write "hello my name is blabla"
![]() |
Similar Threads
- saving a file to database (C#)
- SpecialFolder::System (C++)
- saving file in java (Java)
- Changed default when double-click folder (Windows NT / 2000 / XP)
- While I am Downloading ,One Dialogbox will open.When user will be saving file name... (ASP.NET)
- xp remote desktop across wan/lan (Windows NT / 2000 / XP)
- Saving a file using C++ (C++)
Other Threads in the VB.NET Forum
- Previous Thread: How to find extact word from a column in SQL Table.
- Next Thread: Using wrapper functions for a C++ class (exported in a DLL) in VB.NET app
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
.net 2005 2008 access account application arithmetic array arrays basic bing button buttons c# center check checkbox code combobox component convert crystalreport data database datagrid datagridview date dissertation dissertations dropdownlist excel fade file-dialog ftp generatetags google gridview hardcopy images inline input insert intel internet listview mobile monitor ms net networking objects output passingparameters peertopeervideostreaming picturebox picturebox1 port print printing problem problemwithinstallation project remove save searchbox searchvb.net select serial server shutdown soap sorting survey table tcp temperature text textbox timer toolbox trim update updown user validation vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web winforms wpf





