- Read to end con linguaggio VB.NET
Imports System.IO
Public Class "nome class"
Private Sub Button1_Click(Sender As Object, e As EventArgs) Handles Button1.Click
Me.RichTextBox1.Text = “nometextbox”
Dim parser As New OpenFileDialog
parser.ShowDialog()
Dim NomeFile As String = parser.FileName
Me.RichTextBox1.AppendText(Environment.NewLine & NomeFile)
Dim s As New StreamReader(NomeFile)
Dim All As String = s.ReadToEnd
Me.RichTextBox1.AppendText(Environment.NewLine & All)
End Sub
End Class
Esempio:

- Read to end con linguaggio C#
using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.IO;
public class "nome class"
{
private void Button1_Click(object Sender, EventArgs e)
{
this.RichTextBox1.Text = “nometextbox”;
OpenFileDialog parser = new OpenFileDialog();
parser.ShowDialog();
string NomeFile = parser.FileName;
this.RichTextBox1.AppendText(Environment.NewLine + NomeFile);
StreamReader s = new StreamReader(NomeFile);
string All = s.ReadToEnd;
this.RichTextBox1.AppendText(Environment.NewLine + All);
}
}
Esempio:

- Read line con linguaggio VB.NET
Imports System.IO
Public Class "nome class"
Private Sub Button1_Click(Sender As Object, e As EventArgs) Handles Button1.Click
Me.RichTextBox1.Text = “nometextbox”
Dim parser As New OpenFileDialog
parser.ShowDialog()
Dim NomeFile As String = parser.FileName
Me.RichTextBox1.AppendText(Environment.NewLine & NomeFile)
Dim s As New StreamReader(NomeFile)
Dim Contatore As Integer = 1
Do
Dim RigaDelFile As String = s.ReadLine
Me.RichTextBox1.AppendText(Environment.NewLine & “Riga #” & COntatore & “: ” & RigaDelFile)
Contatore = Contatore + 1
Loop Until s.EndOfStream
End Sub
End Class
Esempio:

- Read line con linguaggio C#
using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.IO;
public class "nome class"
{
private void Button1_Click(object Sender, EventArgs e)
{
this.RichTextBox1.Text = “nometextbox”;
OpenFileDialog parser = new OpenFileDialog();
parser.ShowDialog();
string NomeFile = parser.FileName;
this.RichTextBox1.AppendText(Environment.NewLine + NomeFile);
StreamReader s = new StreamReader(NomeFile);
int Contatore = 1;
do {
string RigaDelFile = s.ReadLine;
this.RichTextBox1.AppendText(Environment.NewLine + “Riga #” + COntatore + “: ” + RigaDelFile);
Contatore = Contatore + 1;
} while (!(s.EndOfStream));
}
}
Esempio:

Nessun commento:
Posta un commento