Контрольная работа: Адресная книга на языка Visual Basic
Public Sub SaveData()
Dim Index As Long
Dim strText As String
SetAttr Path & "data.dat", vbNormal
On Error Resume Next
Open Path & "data.dat" For Output As #1
For Index = 0 To UBound(User)
If Not (User(Index).strKvartira = vbNullString Or User(Index).strDoma = vbNullString Or User(Index).strFamilia = vbNullString Or User(Index).strOtchectvo = vbNullString Or User(Index).strAdress = vbNullString Or User(Index).strComment = vbNullString Or User(Index).strName = vbNullString Or User(Index).strPhone = vbNullString) Then
Print #1, User(Index).strName
Print #1, User(Index).strOtchectvo
Print #1, User(Index).strFamilia
Print #1, User(Index).strAdress
Print #1, User(Index).strDoma
Print #1, User(Index).strKvartira
Print #1, User(Index).strPhone
Print #1, User(Index).strComment
End If
Next
Close
End Sub
Private Sub butAbout_Click()
Load frmAbout
frmAbout.Show vbModal
End Sub
Private Sub butAdd_Click()
ReDim Preserve User(UBound(User) + 1)
lngIndex = UBound(User)
Load frmEdit
frmEdit.Show vbModal