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 Pointscoding a save button for a data gridview
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
my column names are "item code", "item description", "current count" and "on order" The data types are as follows: Item code as string item description as string current count as integer on order as boolean
James Churchill
Treehouse TeacherCameron,
Did you get this working or do you still need help?
Thanks ~James
Chris Jones
Java Web Development Techdegree Graduate 23,933 PointsChris Jones
Java Web Development Techdegree Graduate 23,933 PointsHey Cameron,
When posting code, could you reference the Markdown Cheatsheet? Copy and paste your code as it appears in your IDE (probably Visual Studio in your case) and place three backticks (the key below the Esc key on a PC) above the first line and three backticks below the last line of code.
This will help others in assisting you.
Thanks!