We value your feedback.
Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
Dim sr As StreamWriter Dim strDelimiterType As String Sub Export() strFileName = "test.txt" strDelimiterType = "," 'create streamwriter to open and write contents from datagrid sr = File.CreateText(txtFilePath.Text & "\" & strFileName) 'creat variable to hold delimiter Dim strDelimiter As String = strDelimiterType 'create variable to hold total number of columns Dim intColumnCount As Integer = dgPP.Columns.Count - 1 'create a variable to hold the row data Dim strRowData As String = "" 'get rest of data to file For intX As Integer = 0 To dgPP.Rows.Count - 1 'reset strRowData strRowData = "" For intRowData As Integer = 0 To intColumnCount strRowData += Replace(dgPP.Rows(intX).Cells(intRowData).Value, strDelimiter, "") & _ IIf(intRowData < intColumnCount, strDelimiter, "") Next intRowData 'write row to file sr.WriteLine(strRowData) Next intX 'close streamwriter sr.Close() End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.