Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help learning vb.net 2003

Status
Not open for further replies.
Jun 7, 2005
10
US
I have a program that will browse out to get a file and then save the file somewhere else. How do I use SaveFileDialog1 and FolderBrowserDialog1?
I really need a book that is for beginners, got any ideas?
 
To help you get started:

Code:
  Public Sub BrowseForFolder()
    Dim dlgFolderBrowser As New FolderBrowserDialog
    Dim dlgRetval As DialogResult

    dlgFolderBrowser.RootFolder = Environment.SpecialFolder.Personal
    dlgFolderBrowser.ShowNewFolderButton = True
    dlgFolderBrowser.Description = "Please select the folder to store the file in."
    dlgRetval = dlgFolderBrowser.ShowDialog()

    If dlgRetval = DialogResult.Abort Or dlgRetval = DialogResult.Cancel Then
      Exit Sub
    Else
      'Your code to save the file
      'The selected folder is stored in dlgFolderBrowser.SelectedPath property
    End If
  End Sub

This will open the FolderBrowser Dialog and let the user select a folder. You have to write code to copy the file to that folder yourself.

The difference between the SaveAs Dialog and the FolderBrowser Dialog is that you can specify a different filename in the SaveAs dialog, whereas you can only select a target folder in the FolderBrowser dialog. You cannot use a SaveAs dialog to actually save a file, it only specifies where to store it and what filename to use.

Regards, Ruffnekk
---
Is it my imagination or do buffalo wings taste just like chicken?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top