Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialCameron Byfield
151 Pointsdgv save button
Hi all,
I am creating a data gridview using visual basic and can not for the life of me figure out how to allow the user of the program to save it to their computer.
I am going to create a private sub savethisfile() but I do not know where to start with the code behind it. Can anyone give me some hints around how to get started with this? Also, should the file extension be a csv?
My data grid view has 4 columns and 5 rows - its pretty simple. Here is the code that I have so far..
Private Sub SaveToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SaveToolStripMenuItem.Click Dim Woodstockitemssave = New SaveFileDialog System.IO.Directory.CreateDirectory("C:\Stockfile") Woodstockitemssave.InitialDirectory = "C:\Stockfile" Woodstockitemssave.FileName = "WoodstockStockFile.csv" Woodstockitemssave.Title = "Choose Location to Save" Woodstockitemssave.Filter = "richtextfiles|*.rtf" Woodstockitemssave.AddExtension = True Dim result = Woodstockitemssave.ShowDialog If result = DialogResult.OK Then Savethisfile() End If End Sub