Jump to content

Scripts


hc19
 Share

Recommended Posts

    Public Sub text_combine( _
        ByVal path_to_read_file As String, _
        ByVal path_to_append_file As String _
    )
        System.IO.File.AppendAllText( _
            path_to_append_file, _
            System.IO.File.ReadAllText(path_to_read_file) _
        )
    End Sub

Pedro Martins

Sharing is Knowledge!

http://www.linkedin.com/in/rechousa

Link to comment
Share on other sites

http://wiki.portugal-a-programar.org/dev_net:vb.net:common_dialogs#entender_a_multiseleccao

OpenFileDialog1.Multiselect = True

OpenFileDialog1.Filter = "Ficheiros de sql (*.sql)|*.sql"
OpenFileDialog1.ShowDialog()
For Each Fname As String In OpenFileDialog1.Filenames
    Dim SR As New IO.StreamReader(Fname, True)
    RichTextBox1.Text &= SR.ReadToEnd & vbLf
    SR.Close()
Next

Verifica apenas se não precisas de terminar o último comando com ;.

Alguns clients podem optar por não o colocar nos dumps/exports, por ser o último statement.

Sérgio Ribeiro


"Great coders aren't born. They're compiled and released"
"Expert coders do not need a keyboard. They just throw magnets at the RAM chips"

Link to comment
Share on other sites

Obrigado.

Mais uma coisa, eu utilizei este tipo de código para ir buscar o nome do ficheiro a um ficheiro .txt, mas só consigo  caso o txt tenha uma só linha, ou seja um só nome, será que me podem dizer como ir buscar o nome a cada uma das linhas e abrir cada uma das script's, juntando-as numa só.

OpenFileDialog1.Filter = "Ficheiros de texto|*.txt"
OpenFileDialog1.ShowDialog()
Dim coiso As New IO.StreamReader(OpenFileDialog1.FileName, True)
Dim SR As New IO.StreamReader(" pasta do ficheiro" & coiso.ReadToEnd & ".sql", True)
SaveFileDialog1.Filter = "Ficheiros sql|*.sql"
SaveFileDialog1.ShowDialog()
Dim objWriter As New StreamWriter(SaveFileDialog1.FileName, True)
linha = SR.ReadToEnd
objWriter.WriteLine(linha)
linha = ""
objWriter.Close()
SR.Close()
coiso.Close()

Obrigado

Link to comment
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
 Share

×
×
  • 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.