hey.
i'm making a very basic contacts type program, and one of the fetures is that when the user closes the form it checks is any information has not been saved. but for some reason once i placed this sub in it now doesn't close at all
(please note that it is not even getting to the save changes msgbox)
i'm making a very basic contacts type program, and one of the fetures is that when the user closes the form it checks is any information has not been saved. but for some reason once i placed this sub in it now doesn't close at all
Code:
Private Sub FormClosing() Handles Me.FormClosing
Dim IsDiffrent As Boolean = True
For Counter As Byte = 0 To COM_Name.Items.Count - 1
If COM_Name.Text = COM_Name.Items.Item(Counter) Then
Dim Information(0 To 7) As String
Dim TxtReader As New StreamReader(My.Application.Info.DirectoryPath & "\" & COM_Name.Text & ".txt")
For InfoCounter As Byte = 0 To 7
Information(InfoCounter) = TxtReader.ReadLine
Next
TxtReader.Close()
If Information(0) = TXT_HomePhone.Text And _
Information(1) = TXT_MobPhone.Text And _
Information(2) = DTP_Birthday.Value And _
Information(3) = TXT_HomeAddress.Lines(1) And _
Information(4) = TXT_HomeAddress.Lines(2) And _
Information(5) = TXT_HomeAddress.Lines(3) And _
Information(6) = TXT_HomeAddress.Lines(4) And _
Information(7) = TXT_Email.Text Then
IsDiffrent = False
End If
End If
Next
If IsDiffrent = True Then
Dim Answer As Byte = MsgBox("Do you wish to Save Changes?", MsgBoxStyle.YesNo)
If Answer = 6 Then
Call Save(True, "Closing")
End If
Else
Me.Close()
End If
End Sub
(please note that it is not even getting to the save changes msgbox)