G
GrandpaB
While writing this plea for help, I think I solved my
dilemma, but I don't know why the problem solving
statement is necessary. The inspiration for the
statement came from an undocumented VB example I found on
the web. I would be most appreciative if someone could
explain why this statement is necessary and what does it
do:
MyArt = New Art
Early in the code, ArtList, MyArt & AddNew had been
declared with the following statements:
Public ArtList as New ArrayList
Public MyArt as New Art
Public AddNew as Boolean
I am creating a Windows application which uses an
ArrayList to contain a small amount of data. ArtList, is
an instance of an ArrayList that will contain multiple
(up to 200) Art objects. MyArt is an instance of the Art
object. In the application I want to add, delete and
edit the individual Art objects in ArtList. I am
serializing and deserializing the ArrayList and using a
FileStream to read and write to the hard drive. This is
the code in question, and the mystery statement is
commented with ******
Private Sub btnNew_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnNew.Click
ClearForm() 'A sub to clear the Form's textboxes
AddNew = True
End Sub
Private Sub btnAdd_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnAdd.Click
Dim Msg1 As String = "Do you want to ADD this new
Object?"
Dim Msg2 As String = "Update Art"
Dim Ans As MsgBoxResult
If FormChanged() And AddNew Then
Ans = MsgBox(Msg1, MsgBoxStyle.YesNo, Msg2)
If Ans = MsgBoxResult.Yes Then
MyArt = New Art '??? ********* ???
Form2MyArt() 'Move textbox entries to MyArt
ArtList.Add(MyArt)
SaveFile() 'Serialize ArtList & write
FileStream
End If
End if
End Sub
dilemma, but I don't know why the problem solving
statement is necessary. The inspiration for the
statement came from an undocumented VB example I found on
the web. I would be most appreciative if someone could
explain why this statement is necessary and what does it
do:
MyArt = New Art
Early in the code, ArtList, MyArt & AddNew had been
declared with the following statements:
Public ArtList as New ArrayList
Public MyArt as New Art
Public AddNew as Boolean
I am creating a Windows application which uses an
ArrayList to contain a small amount of data. ArtList, is
an instance of an ArrayList that will contain multiple
(up to 200) Art objects. MyArt is an instance of the Art
object. In the application I want to add, delete and
edit the individual Art objects in ArtList. I am
serializing and deserializing the ArrayList and using a
FileStream to read and write to the hard drive. This is
the code in question, and the mystery statement is
commented with ******
Private Sub btnNew_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnNew.Click
ClearForm() 'A sub to clear the Form's textboxes
AddNew = True
End Sub
Private Sub btnAdd_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnAdd.Click
Dim Msg1 As String = "Do you want to ADD this new
Object?"
Dim Msg2 As String = "Update Art"
Dim Ans As MsgBoxResult
If FormChanged() And AddNew Then
Ans = MsgBox(Msg1, MsgBoxStyle.YesNo, Msg2)
If Ans = MsgBoxResult.Yes Then
MyArt = New Art '??? ********* ???
Form2MyArt() 'Move textbox entries to MyArt
ArtList.Add(MyArt)
SaveFile() 'Serialize ArtList & write
FileStream
End If
End if
End Sub