Google+ Followers

giovedì 9 aprile 2015

Codice Visual Studio per l'apertura di un file


Imports System
Imports System.IO
Imports System.Text


Public Class Form1

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        Dim o As New OpenFileDialog
        o.ShowDialog()

        Dim nomeFileSelezionato = o.FileName
        Me.RichTextBox1.AppendText(nomeFileSelezionato)



        Dim sr As StreamReader = New StreamReader(nomeFileSelezionato)

        Do While sr.Peek() >= 0
            Me.RichTextBox1.AppendText(vbCrLf & sr.ReadLine())
        Loop
        sr.Close()

        'Function Split(
        '    ByVal nomeFileSelezionato As String,
        '    Optional ByVal Delimiter As String = " ",
        '    Optional ByVal Limit As Integer = -1,
        '    Optional ByVal Compare As CompareMethod = CompareMethod.Binary
        ') As String()

    End Sub
End Class

Nessun commento:

Posta un commento