Im having a little problem with forms :)
Basicly, I have a listview of records and when a user dbl click's a record it opens a new instance of the displayrecord form. The user can open multiple records but if a use tries to open record for which they already have the form open it will just brings the existing open form to focus (I store he record ID in the .TAG so I know which form is for which record)
Now everything works great inc bring the already existing form to focus, apart from when I close a form it dosnt get removed from the collection object that stored all the forms so I cant reopen a record after its closed.
I've inc'd some code to hopfully make it clear how im doing it.
[Main Form (frmMain) With Listview on it]
Friend Shared oFormCollection as New Collection
[In Listview dblClick Code]
'// Before loading form lets make sure it isnt already open
Dim iRecordToOpen As Integer
iRecordToOpen = '// Code Here
Dim oForm As Form
Dim bLoadNewForm As Boolean = True
For Each oForm In frmMain.oFormCollection
If oForm.Tag = iRecordToOpen Then
bLoadNewForm = False
'// If form isnt open then create a instance of the record form and display it
If bLoadNewForm Then
Dim oNewForm As New frmDisplayRecord(iRecordToOpen)
oNewForm.StartPosition = FormStartPosition.CenterScreen
oNewForm.TopMost = True
It apears when I close the form, the instance of the form object stays in the oFormCollection, which mean if I wish to reopen the record it already thinks is open. Am I going about this the wrong way?