29 Mayıs 2014 Perşembe
Encoding.Default ile text okuma Yazdırma
Encoding.Default ile text okuma Yazdırma ve Linklabel ile siteye bağlanma Proje Örneği :
KOD İNDİR
Imports System Imports System.IO Imports System.Text Public Class Form1 Dim TxtOku As System.IO.StreamReader Dim Dsy_Adi As String = Application.StartupPath & "\BeniOku.txt" Private Sub btnOku_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOku.Click If Not File.Exists(Dsy_Adi) Then Console.WriteLine("{0} Dosya Yok.", Dsy_Adi) Return End If TxtOku = New IO.StreamReader(Dsy_Adi, System.Text.Encoding.Default) TextBox1.Text = TxtOku.ReadToEnd TxtOku.Close() End Sub Private Sub LinkLabel1_LinkClicked(sender As System.Object, e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked System.Diagnostics.Process.Start("http://eraslancemil1.blogspot.com.tr/") End Sub Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load LinkLabel1.Text = "VB.NET 2010 İLE ÖRNEK KODLAR" LinkLabel2.Text = "Bilgisayar Dünyası" LinkLabel2.Links.Add(0, LinkLabel1.Text.Length, "http://eraslancemil.blogspot.com/") End Sub Private Sub LinkLabel2_LinkClicked(sender As System.Object, e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel2.LinkClicked System.Diagnostics.Process.Start(e.Link.LinkData) End Sub Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Try Dim TextYaz As New StreamWriter(Dsy_Adi, False, Encoding.Default) TextYaz.Write(TextBox1.Text) TextYaz.Close() TextYaz = Nothing Catch ex As Exception MsgBox(ex.Message()) End Try End Sub Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click Try Dim openDLG As New OpenFileDialog openDLG.Filter = "Text Dosyası(*.txt)|*.txt" If openDLG.ShowDialog = DialogResult.OK Then Dim ds_adi As String ds_adi = openDLG.FileName Dim fr As New StreamReader(ds_adi) TextBox1.Text = fr.ReadToEnd() End If Catch exc As Exception MessageBox.Show(exc.Message, " Error", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try End Sub Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click TextBox1.Text = Nothing End Sub End Class
Hiç yorum yok:
Yorum Gönder
Sonraki Kayıt
Önceki Kayıt
Ana Sayfa
Kaydol:
Kayıt Yorumları (Atom)
Hiç yorum yok:
Yorum Gönder