| Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free! |
Vb .net saving file
|
Original Message
|
Name: karahim
Date: January 31, 2005 at 19:09:50 Pacific
Subject: Vb .net saving fileOS: Windows 2000CPU/Ram: AMD Athlon 512MB |
Comment: I am new to VB .NET. I am trying to select a file and saving it with another name, but file is not being saved with new name. Kindly advise. The code is: Private Sub btnOpenFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpenFile.Click OpenFileDialog1.InitialDirectory = "c:\" OpenFileDialog1.Title = "Select a File" OpenFileDialog1.Filter = "Text Files|*.txt" OpenFileDialog1.FilterIndex = 1 If OpenFileDialog1.ShowDialog() <> DialogResult.Cancel Then txtSource.Text = OpenFileDialog1.FileName Else txtSource.Text = "" End If End Sub Private Sub btnSaveFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSaveFile.Click SaveFileDialog1.Title = "Specify Destination Filename" SaveFileDialog1.Filter = "Text Files|*.txt" SaveFileDialog1.FilterIndex = 1 SaveFileDialog1.OverwritePrompt = True SaveFileDialog1.CreatePrompt = True If SaveFileDialog1.ShowDialog() <> DialogResult.Cancel Then txtDestination.Text = SaveFileDialog1.FileName End If End Sub karahim
Report Offensive Message For Removal
|
|
Response Number 1
|
Name: StuartS
Date: January 31, 2005 at 22:50:37 Pacific
|
Reply: (edit)There is nothing in your code that actually saves a file, or opens it for that matter. All you have is two functions to select two different files. You need to do something with txtSource.Text and txtDestination.Text which are just two text boxes with filenames in them. You would probably be better just using the Copy command to copy the source to the destination. Stuart
Report Offensive Follow Up For Removal
|

Post Locked
This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
Go to Programming Forum Home