10-06-21, 04:23 AM
28-11-21, 08:13 PM
(10-06-21, 04:23 AM)العواجي كتب : [ -> ]عفوا اخواني
اريد كود الكتابة في مكان محدد في الملف txt
وليكن في اخر الملف
وشكرا للجميع
PHP كود :
Imports System.IO
Public Class Form1
Dim txtpath As String = IO.Path.GetDirectoryName(Application.ExecutablePath) & "\t.txt"
Private Sub gd()
ListBox1.Items.Clear()
For Each h As String In My.Computer.FileSystem.ReadAllText(txtpath).Split(vbNewLine)
If Trim(h.Trim).Trim <> "" Then
ListBox1.Items.Add(h.ToString.Trim)
End If
Next
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
If IO.File.Exists(txtpath) = False Then
IO.File.CreateText(txtpath).Close()
End If
gd()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If TextBox1.Text.Trim <> "" Then
Dim sr As StreamWriter
sr = IO.File.AppendText(txtpath)
sr.WriteLine(TextBox1.Text)
sr.Close()
End If
TextBox1.Clear()
TextBox1.Focus()
TextBox1.Select()
gd()
End Sub
End Class