|
-
Jun 7th, 2004, 09:11 AM
#1
Thread Starter
Lively Member
MDI Forms and Modality
Is Modality even a word?
Anyway...
I'm making an app that adds defects found while testing to a database. I have a form that adds the info to a database as a child in an MDI container. Once we post the fix for the defect, I need to update that row in the database with new information. I have another child form that does that.
Sometimes procedures are overlooked and I end up trying to post a defect that has not been added yet. In this case, I pop up the "add defect" form as an MDI child. I want to make it so that when I hit the submit button on the "add defect" form, it adds the defect to the database and then the "post defect" form can finish updating the information.
So first I tried this:
VB Code:
Dim addDefect As New ChildForm5
addDefect.MdiParent = Me.MdiParent
addDefect.TextBox1.Text = TextBox1.Text
addDefect.Show()
Dim UpdateCommand As OleDb.OleDbCommand = New OleDb.OleDbCommand("PostDefect", myOleDbConnection)
UpdateCommand.CommandType = CommandType.StoredProcedure
Dim objParam As OleDb.OleDbParameter = New OleDb.OleDbParameter
objParam = UpdateCommand.Parameters.Add("@DefectState", OleDb.OleDbType.BSTR)
objParam.Direction = ParameterDirection.Input
objParam.Value = 1
etc...
but with the .Show(), the app blows right past it and tries to update the row before it is added. If I use .ShowDialog() to halt execution of the "post defect" form I get an exception with the parent form. However, if I comment out the line assinging the "add defect" form a parent, it works, but the new window is no longer contained in the parent form. Is there a way to get around this?
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
|