Get window to repaint

S

sippyuconn

Here is scenario

Parent Form -> Call Child Modal Form -> Shows Mesage Box then executes Sql
Statement to delete rows in table.

When I execute the sql statement the Message box doesn't completely disappear
/repaint.
Is there a good way to get the MessageBox to hide

IF MessageBox.Show("Delete Table?", "Delete Records", ) = DialogResult.OK THEN

cmdQuery.DbExecute(sSQL)
CloseDB()
ENDIF
 
T

Thorsten Doerfler

sippyuconn said:
Parent Form -> Call Child Modal Form -> Shows Mesage Box then executes Sql
Statement to delete rows in table.

When I execute the sql statement the Message box doesn't completely disappear
/repaint.
Is there a good way to get the MessageBox to hide

IF MessageBox.Show("Delete Table?", "Delete Records", ) = DialogResult.OK THEN

cmdQuery.DbExecute(sSQL)
CloseDB()
ENDIF

<ChildModalForm>.Refresh() before executing the SQL query did not help?

Thorsten Doerfler
 
J

Jialiang Ge [MSFT]

Hello sippyuconn,

Apart from Thorsten's suggestion, we can also consider creating a new
thread, and run the db operations in it.

If MessageBox.Show("Delete Table?", "Delete Records") = DialogResult.OK Then
Dim dbThread As New Thread(New ThreadStart(AddressOf RunDBCmd))
dbThread.Start()
End If

Private Sub RunDBCmd()
'Run db cmd.
End Sub

If you have any other concerns or questions, please feel free to let us
know.

Regards,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

=================================================
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from your issue.
=================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
A

Andrew Backer

Could you describe exactly what is happening? Is the messagebox still showing,
and usable? Or does it look like there are remanants of the messagebox on
the parent form, and the parent form is usable? Does minimizing the parent
form (or dragging off/on screen) cause visual corruption to be erased?

You can try calling ".Invalidate()" on the parent form after the parent messagebox
closes

If MessageBox.Show(...) ... Then
Me.Invalidate()
Do Stuff
End If
 
J

Jialiang Ge [MSFT]

Hi sippyuconn,

I am writing to check the status of the issue. Would you mind letting me
know the result of the suggestions? If you need further assistance, feel
free to let me know. I will be more than happy to be of assistance.

Have a great day!

Regards,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

=================================================
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from your issue.
=================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top