Jump to content
hc19

Ajuda a adaptar

Recommended Posts

hc19

Boa tarde, precisava de uma ajuda a implementar este código:

Private Function RecursiveSearch(ByVal path As String) As Boolean
        Dim dirInfo As New IO.DirectoryInfo(path)
        Dim fileObject As FileSystemInfo
        For Each fileObject In dirInfo.GetFileSystemInfos()
            If fileObject.Attributes = FileAttributes.Directory Then
                RecursiveSearch(fileObject.FullName)
            Else
                Console.WriteLine(fileObject.FullName)
            End If
        Next
        Return True

neste :

 Try
            For Me.j = 0 To (DataGridView1.Rows.Count - 2) ' estava -1
                For Me.I = 1 To (DataGridView1.Columns.Count - 1)
                    If Not TypeOf DataGridView1.CurrentRow.Cells.Item(I).Value Is DBNull Then
                        valorCelula = DataGridView1.Item(2, j).Value
                    End If
                Next
                File.AppendAllText("saida.sql", File.ReadAllText(valorCelula & ".sql") & Environment.NewLine, Encoding.Default)
            Next
            Dim SR As New IO.StreamReader("caminho" & "saida.sql", True)
            SaveFileDialog1.Filter = "Ficheiros sql|*.sql"
            SaveFileDialog1.ShowDialog()
            Dim objWriter As New StreamWriter(SaveFileDialog1.FileName, True)
            If SaveFileDialog1.FileName <> "" Then
                linha = linha + SR.ReadToEnd
                objWriter.WriteLine(linha)
                linha = ""
                objWriter.Close()
                SR.Close()
                FileClose(1)
                MsgBox("Ficheiro guardado com sucesso.")
            End If
        Catch ex As Exception
End Try

Será que me podiam ajudar?

( a pasta que pretendo filtrar, encontra-se no Ambiente de Trabalho)

Obrigado

Share this post


Link to post
Share on other sites
bioshock
RecursiveSearch(IO.Path.GetFullPath(SaveFileDialog1.FileName))

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.