none
Criar caminho do arquivo csv. salva pasta o código abaixo RRS feed

  • Pergunta

  •  

    Gostaria criar caminho  para salvar o csv na pasta C:\Geral\CSV\.

    E também chamar ela na  ExportAllToolStripMenuItem_Click

     Private Sub ExportAllToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ExportAllToolStripMenuItem.Click
            Export(0)

    Exemplo<><><><C:\Geral\CSV\.   

    End Sub

    Public Sub Export(ByVal ExportType As Integer)
            Dim saveDlg As New SaveFileDialog
            saveDlg.Filter = "*.csv|*.csv"
            Dim result As String = ""
            If saveDlg.ShowDialog = DialogResult.OK Then
                For Each li As ListViewItem In ListViewNumbers.Items
                    If ExportType = 0 Then
                        result = result & li.SubItems(0).Text & ";" & li.SubItems(1).Text & ";" & li.SubItems(3).Text & ";" & li.SubItems(4).Text & ";" & li.SubItems(5).Text & vbNewLine
                    Else
                        If li.ImageIndex = 0 Then
                            result = result & li.SubItems(0).Text & ";" & li.SubItems(1).Text & ";" & li.SubItems(3).Text & "," & li.SubItems(4).Text & ";" & li.SubItems(5).Text & vbNewLine
                        End If
                    End If
                Next
                IO.File.WriteAllText(saveDlg.FileName, result)
            End If
        End Sub

        Private Sub ExportAllToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ExportAllToolStripMenuItem.Click
            Export(0)
        End Sub

      

     
    terça-feira, 14 de julho de 2020 18:32