473,387 Members | 1,650 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Form Not Painted / Visible !

I have a msgbox in my form activate event with an OK button.

However the msgbox shows up BEFORE the form is painted.

I would like the msgbox to be visible after the form gets painted on
screen.

Is there any way I can do that from the Activate event ?

I know that if I place my code in the curent event it will work, but
this code will fire for each record navigated.

Thx & Best Rgds,
Prakash.

Nov 13 '05 #1
8 2474
On 25 Jul 2005 02:02:24 -0700, "Prakash" <si****@omantel.net.om>
wrote:

This may be one of the few good reasons for a well-placed DoEvents
call. Put it just before the MsgBox call.

-Tom.
I have a msgbox in my form activate event with an OK button.

However the msgbox shows up BEFORE the form is painted.

I would like the msgbox to be visible after the form gets painted on
screen.

Is there any way I can do that from the Activate event ?

I know that if I place my code in the curent event it will work, but
this code will fire for each record navigated.

Thx & Best Rgds,
Prakash.


Nov 13 '05 #2
how about using "OnLoad"?

Nov 13 '05 #3
I should have mentioned I guess:

I did try a DoEvents ... does'nt work.

OnLoad is no use because the order of Form Events (while opening) is:
Open → Load → Resize → Activate → Current

Any ideas anyone ?? How can we force a form to finish drawing
(becoming 100% visible) before the Curent Event is activated ?

Thx & Best Rgds,
Prakash.

Nov 13 '05 #4
Prakash wrote:
I should have mentioned I guess:

I did try a DoEvents ... does'nt work.

OnLoad is no use because the order of Form Events (while opening) is:
Open → Load → Resize → Activate → Current

Any ideas anyone ?? How can we force a form to finish drawing
(becoming 100% visible) before the Curent Event is activated ?

Thx & Best Rgds,
Prakash.

Not tested, but how about a form level variable, say:

Dim booMsgDisplay as Boolean

In the on open event, have a line:

booMsgDisplay = True

Now put an if statement with your on current event.

If booMsgDisplay = True then

Msgbox "blah, blah, blah and how are you today?"

booMsgDisplay = false

end if

booMsgDisplay will then be false and the msgbox won't go off until the
form is closed and then opened again.

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Nov 13 '05 #5
On 25 Jul 2005 06:52:09 -0700, "Prakash" <si****@omantel.net.om>
wrote:

One solution may be to tick a 1 msec timer in OnLoad, and in the Timer
event turn the timer off and display your message.

-Tom.

I should have mentioned I guess:

I did try a DoEvents ... does'nt work.

OnLoad is no use because the order of Form Events (while opening) is:
Open ? Load ? Resize ? Activate ? Current

Any ideas anyone ?? How can we force a form to finish drawing
(becoming 100% visible) before the Curent Event is activated ?

Thx & Best Rgds,
Prakash.


Nov 13 '05 #6
er, i think we may have misunderstood the problem a bit.

The message box is visible ... but BEFORE the form gets painted.

I'd like the form to first get painted & then the msgbox to be visible
.... because there is a column of data in the form which is populated
with incorrect values & I'd like the user to be able to see that column
behind the msgbox.

Then when the user clicks ok to close the msgbox, the column gets
populated with the correct values.


Private Sub Form_Activate()
Dim msg As String, msg1 As String, msg2 As String

Me.Repaint
DoEvents
MsgBox "Form Activated"

'If any SUB_TRAN_NO has a "ZERO" value, Re-Number all the Rows with
new STN values
If Nz(DMin("[SUB_TRAN_NO]", "JV_Edit_Delete")) = 0 Then
msg1 = "Sub-Transaction Numbers Not Proper !"
msg2 = "Rows will be Re-Numbered !"
msg = msg1 + Chr(10) + Chr(10) + msg2
MsgBox msg, vbOKOnly + vbInformation, "Message..."
Call Cmd_ReNumber_Click 'Re-Number the sub_tran_no field
End If

End Sub
Hoping something is visible to you'll I may have missed.

Thx & Best Rgds,
Prakash.

Nov 13 '05 #7
Option Compare Database
Option Explicit

Dim txtSW As String

Private Sub Form_Activate()
If txtSW = "L" Then
txtSW = " "
Else
MsgBox "this is the message 1", 48
End If
End Sub

Private Sub Form_Open(Cancel As Integer)
txtSW = "L"
End Sub
You didn't say if you wanted this to dislpay when the form is
opened the first time.

You can also put your code in the GotFocus event of the first
control on the form and test by setting a switch in the
OnActivate event of the form to see if the user came from another
form or another control back to the first control.

Ron

Prakash wrote:
er, i think we may have misunderstood the problem a bit.

The message box is visible ... but BEFORE the form gets painted.

I'd like the form to first get painted & then the msgbox to be visible
... because there is a column of data in the form which is populated
with incorrect values & I'd like the user to be able to see that column
behind the msgbox.

Then when the user clicks ok to close the msgbox, the column gets
populated with the correct values.


Private Sub Form_Activate()
Dim msg As String, msg1 As String, msg2 As String

Me.Repaint
DoEvents
MsgBox "Form Activated"

'If any SUB_TRAN_NO has a "ZERO" value, Re-Number all the Rows with
new STN values
If Nz(DMin("[SUB_TRAN_NO]", "JV_Edit_Delete")) = 0 Then
msg1 = "Sub-Transaction Numbers Not Proper !"
msg2 = "Rows will be Re-Numbered !"
msg = msg1 + Chr(10) + Chr(10) + msg2
MsgBox msg, vbOKOnly + vbInformation, "Message..."
Call Cmd_ReNumber_Click 'Re-Number the sub_tran_no field
End If

End Sub
Hoping something is visible to you'll I may have missed.

Thx & Best Rgds,
Prakash.


Nov 13 '05 #8
Thx Ron !

Sorry if I was a tad ambiguous.
Rgds,
Prakash.

Nov 13 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Will | last post by:
Hi All, I'm trying to find the correct form event to use to make a call to a database AFTER my form has been completely painted. The call to the database takes a few seconds and when I tried...
9
by: JW | last post by:
Dear NG, Still working on my .NET CF C# forms application ... I have an array of forms that I wish to display in array order, and thus have created a loop to run through them. Due to...
4
by: Grant Schenck | last post by:
I have a C# form application. Once my main window is showing I want to pop-up a login type dialog. What event would I trap to affect this? I tried handling the form load but the main form window...
2
by: Carsten Klotz | last post by:
Hi, does someone know, if it's possible capturing the content of a panel, when its form has state "minimized"? Details: A panel contains a Webbrowser object (AxSHDocVw.AxWebBrowser). My...
6
by: John | last post by:
Hi Is there a way to open a form hidden/invisible while it is populating its controls, and then make it visible once it is done? I am using the following code but the form remains visible. ...
7
by: moondaddy | last post by:
I'm painting images onto a windows form using this method: e.Graphics.DrawImageUnscaled(m_ItemImage, x, y) every time I select a product. However, some products don't have an image so when a...
4
by: hzgt9b | last post by:
Using VB .NET 2003, I have a windows application that performs a series of file actions (copy, move, delete) but the actions are completing before the window is painted on the screen... how can I...
6
by: Nayan | last post by:
I have been working on a card game (called Uno) for past few days. Language used : C# 2.0 When I start a new game, a dialog window pops up asking the name of the player. I enter the name, and...
15
by: Angelo | last post by:
Hi all, I'm using a FileSystemWatcher to monitor a directory. I want the FSW to pop up my already instantiated but invisible form. However, I'm running into some problems with this. 1) In...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.