اخي keko ferkeko
لقد قمت بتصميم برنامج يشبه البرنامج الذي وضعته انت في المرفقات
وهذا هو الكود
الفورم 1
Public Function readLine(ByRef strFilePath As String, ByVal nLine _
As Integer) As String
Dim n As Integer
Dim NextLine As String
FileNum = FreeFile
Open strFilePath For Input As FileNum
Do Until EOF(FileNum)
Line Input #FileNum, NextLine
n = n + 1
If n = nLine Then readLine = NextLine
Loop
Close
End Function
Private Sub Command1_Click()
Dim NewText As String
If Text1 = "" Or Text2 = "" Then MsgBox "ÊÇßÏ ãä ãáÁ ÌãíÚ ÇáÍÞæá ÈÇáÞíã ÇáÕÍíÍÉ"
With Text3
NewText = Text1 & " " & Text2
.SelText = vbNewLine & NewText
End With
Text1 = ""
Text2 = ""
End Sub
Private Sub Command2_Click()
Unload Me
Form2.Show
Open "d:\windows\phonebook.txt" For Input As #1
Count:
ss = ss + 1
Line Input #1, X
If EOF(1) Then
For i = 1 To ss
Form2.List1.AddItem readLine("d:\windows\phonebook.txt", i)
Next
Exit Sub
Else
GoTo Count:
End If
Close
End Sub
Private Sub Command3_Click()
w = MsgBox("åá ÇäÊ ãÊÃßÏ ãä Ãäß ÊÑíÏ ÍÐÝ ÌãíÚ ÃÑÞÇã ÇáåÇÊÝ ÇáãæÌæÏÉ áÏíß", vbInformation + vbYesNo, "ÊÃßíÏ ÇáÍÐÝ")
If w = vbYes Then Text3 = ""
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
Private Sub Form_Load()
Text3.Enabled = False
Open "d:\windows\phonebook.txt" For Input As #1
Text3 = Input(LOF(1), 1)
Close #1
End Sub
Private Sub Form_Unload(Cancel As Integer)
Open "d:\windows\phonebook.txt" For Output As #1
Print #1, Text3
Close #1
End Sub
الفورم 2
Dim ss As Integer
Private Sub Command1_Click()
On Error Resume Next
List1.RemoveItem List1.ListIndex
End Sub
Private Sub Command2_Click()
Dim NewText As String
Form1.Text3.Text = Clear
For i = 0 To List1.ListCount
If List1.ListCount = 0 Then
NewText = ""
Form1.Text3.SelText = vbNewLine & NewText
Else
NewText = List1.List(i)
Form1.Text3.SelText = vbNewLine & NewText
End If
Next
List1.Clear
Unload Me
Form1.Show
End Sub
ان شاء الله تستفيد