|
-
Jan 1st, 2008, 06:33 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] [2008] Problem closing/opening forms
Hi,
I have Form1 which contains a button which opens Form2. Form2 contains a datagrid. I have coded it, so that when an item is double-clicked, it opens the database record which is shown on Form1.
(Form1 is the database showing names, addresses etc, Form2 is a datagrid that shows everything in the database, allowing one item to be selected and load the details into Form1 - hope this is making sense).
Anyway, what happens is this...
1) Either when double-clicking my grid item, the whole application closes down (because I want to close Form2 after the item is selected)
OR
2) It loads the details into Form1, but opens a new instance of Form1 - thus leaving me with the original Form1 which is blank (which I want to close without closing the whole app), a new populated Form1 (which is correct) and grid in Form2 (which I wanted to close down).
Can anyone help with this please?
The code I am using at the moment is as per item (2) above:
Code:
Dim Form1 As New Form1
MainForm.GetRecordFromGrid(intAccId)
MainForm.ShowDialog()
Me.close
I've tried all sorts of variations form1.close, form1.hide and in different orders - always getting different results but never what I actually want.
Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|