Hi
I have a richtextbox with a textchanged event. This event fires when the text box is first loaded with data, understandably. This is the code:
I dont want bHasChanged to be set to true, upon loading, just when the user changes something. This value is then checked upon closing, and uses it to determine whether to prompt about saving changes. I can solve this by having a 'bFirstLoad' like below:
This will solve the problem, but it just seem unprofessional to me, is there a better way of doing this?
Thanks.
I have a richtextbox with a textchanged event. This event fires when the text box is first loaded with data, understandably. This is the code:
Visual Basic:
Private Sub rtfText_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles rtfText.TextChanged
bHasChanged = True
End Sub
I dont want bHasChanged to be set to true, upon loading, just when the user changes something. This value is then checked upon closing, and uses it to determine whether to prompt about saving changes. I can solve this by having a 'bFirstLoad' like below:
Visual Basic:
Dim bFirstLoad as boolean = True
Private Sub rtfText_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles rtfText.TextChanged
If bFirstLoad Then
bFirstLoad = False
Else
bHasChanged = True
End If
End Sub
This will solve the problem, but it just seem unprofessional to me, is there a better way of doing this?
Thanks.