473,322 Members | 1,496 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,322 software developers and data experts.

Need Help with Form Instancing


Hi All,

Coming from VB6, there was a bit of a difference in the way you
display a form, I Thought I'd nailed instanciating a form, but I'm
quite stuck with something that doesn't make sense.

my main form has an event handler that instanciates a small popup form
each time it fires, the code inside the handler is:

Dim f As New frmInfoPopup
f.Show()

as soon as the End Sub of the handler is reached, it locks that form,
and doesn't repaint it, if I attempt to close it, it says its not
responding, at some point I got some mention of a
"WindowsFormParkingWindow" which wouldn't close.

I have other event handlers that instansiate a form just the same, and
they work fine.

Just as an experiment I added this to the handler:

do while f.visible
application.doevents
loop

and all is well, except that it stays in that loop using up lots of
CPU time until the popup window is closed.

BTW, the actual frmInfoPopup form/class has no code inside.

Any Help?

Scott

Nov 20 '05 #1
5 1108
Cor
Hi Scott,

I have a sample still in my clipboard, I only have to do right click and
paste
I was sending this to Whitesocks I pasted it again beneath this message to
you.

That do loop you should never use anymore in my opinion.

If you want to use it you can add something as
\\\
do while xx
threading.thread.sleep(1000) ' this is the main thread which sleeps than 1
second,
...........
loop
///
But I think you can better use a timer as I show bellow.

Maybe this helps you?

Cor

\\\form1
Private frm As New Form2
Private Sub Form1_Load(ByVal sender _
As Object, ByVal e As System.EventArgs) _
Handles MyBase.Load
frm.Show()
End Sub
///
\\\form2

Private WithEvents timer1 As New Windows.Forms.Timer
Private Sub Form2_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Label1.Text = "High I Am Here"
Me.ForeColor = Color.White
timer1.Enabled = True
timer1.Interval = 125
Me.BackColor = Color.CornflowerBlue
Me.Opacity = 1
Me.TopMost = True
Me.Text = "Splash"
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles timer1.Tick
Me.Opacity -= 0.01
If Me.Opacity = 0 Then
timer1.Enabled = False
Me.Close()
End If
End Sub
///
I hope this helps a little bit?

Cor
Nov 20 '05 #2
* Scott H <x@y.com> scripsit:
Coming from VB6, there was a bit of a difference in the way you
display a form, I Thought I'd nailed instanciating a form, but I'm
quite stuck with something that doesn't make sense.

my main form has an event handler that instanciates a small popup form
each time it fires, the code inside the handler is:

Dim f As New frmInfoPopup
f.Show()

as soon as the End Sub of the handler is reached, it locks that form,
and doesn't repaint it, if I attempt to close it, it says its not
responding, at some point I got some mention of a
"WindowsFormParkingWindow" which wouldn't close.


<http://groups.google.com/groups?ie=UTF-8&q=windowsformsparkingwindow+group%3A*dotnet*>

--
Herfried K. Wagner [MVP]
<http://dotnet.mvps.org/>
Website Address Changed!
Nov 20 '05 #3

Thanks for the code, it did help a little, although i did still get
locks ups, but its fine if I only have one instance, so I've done it a
slightly different way, now things are working well.

The thing is, theres one thing that still puzzles me...this :

private sub example()
dim frm as new Form2
frm.show
end sub

as the frm object is created within the "example" sub, when it hits
the end sub line, how come the "frm" object isn't distroyed....its
gone out of scope hasn't it?

The reason I ask is, it seemed like this is what was happening in my
app, as soon as it hit the end sub it was trying to both open and
close the form just created...maybe I'm wrong.

Thanks,
Scott

On Sat, 6 Mar 2004 17:23:28 +0100, "Cor" <no*@non.com> wrote:
Maybe this helps you?
\\\form1
Private frm As New Form2

<SNIP>
Nov 20 '05 #4
Cor
Hi Scott,

Thanks for the code, it did help a little, although i did still get
locks ups, but its fine if I only have one instance, so I've done it a
slightly different way, now things are working well.

The thing is, theres one thing that still puzzles me...this :

private sub example()
dim frm as new Form2
frm.show
end sub


That sample is exacly about the problem you describe, why did you not try
it?
(You can replace that private form to that as you have above)

Cor
Nov 20 '05 #5
* Scott H <x@y.com> scripsit:
The thing is, theres one thing that still puzzles me...this :

private sub example()
dim frm as new Form2
frm.show
end sub

as the frm object is created within the "example" sub, when it hits
the end sub line, how come the "frm" object isn't distroyed....its
gone out of scope hasn't it?

The reason I ask is, it seemed like this is what was happening in my
app, as soon as it hit the end sub it was trying to both open and
close the form just created...maybe I'm wrong.


The form won't be closed then 'frm' runs out of scope.

--
Herfried K. Wagner [MVP]
<http://dotnet.mvps.org/>
Nov 20 '05 #6

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

Similar topics

0
by: Kookymon1 | last post by:
This is an attempt to respond to an older question (several months). Date: 2002-03-07 13:10:23 PST Subject: On the Common DOM API and Applets. The original message was: >LiveConnect and the...
15
by: Mark Sisson | last post by:
Hey all. I've got a legacy COM dll that I'd like to use in my multithreaded C# app. Problem though is when I create several instances of the interop object and start them on their own threads...
1
by: bajopalabra | last post by:
hi this code bellow get data from a web service (tradicional asp) but result is not parsed into XML ... that is, JUST get "cat4" instead of "<animal><name>cat</name><legs>4</legs></animal> set...
1
by: Srinivasa Parupalli | last post by:
Dear Friends, I am struck up with logic. I am using one class(BMSLexer) which takes filename as arugument and the instance of the class is used my another class. example is shown below. Now my...
1
by: Christopher | last post by:
Looking for a proper way to close or hide a form in this example. I have a form X that calls a new form Y to show on a given event. Both X and Y are different classes. Ive tried instancing X...
1
by: Steve | last post by:
Can anyone explain why C++ .NET compiler throws error for the following code segment: // Forward declaration of ListViewItemComparer class public __gc class ListViewItemComparer ; public __gc...
4
by: poldoj | last post by:
Hi all, I have a simple question. I have 2 form; form1 is the main form and form2 is a secondary form. Just wondering if is possible to change the text value of a control label placed in the form1...
15
by: Alex McMillan | last post by:
Hey - I know a bit about vb, written a few progs, upgraded to .net 2003 but can't figure it out. Where has everything gone? Am I missing something really obvious? I'm trying to create a...
2
by: Chicken15 | last post by:
Hi Group. First of all I'm sorry for asking (maybe) such easy questions. But I'm quite stuck now and couldn't come up with a solution by using my C# book or googling. So it would be nice if...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.