Hi there, this is probably really dumb, but I am using a dialog as my main
form and my startup form is my splash screen - which implements some
progress bars to load up some relevant data. When that is done, loading
form does this:
Me.Visible = False
mainform.ShowDi alog()
Application.Exi t()
So far so good (is this a dumb way of doing that???). Now, I am
implementing a notification icon in mainform. Here is some relevant stuff:
(class variable shown as boolean = true and notify icon set up correctly)
Private Sub Open_Click(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles NotifyIcon1.Dou bleClick
Me.WindowState = FormWindowState .Normal
Me.ShowInTaskba r = True
shown = True
NotifyIcon1.Vis ible = False
End Sub
Private Sub MainFormSizeCha nged(ByVal sender As Object, ByVal e As
System.EventArg s) Handles MyBase.SizeChan ged
If shown And Me.WindowState = FormWindowState .Minimized Then
shown = False
Me.ShowInTaskba r = False
NotifyIcon1.Vis ible = True
End If
End Sub
Here is the problem: When I hit the ol minimize button on mainform, the
application control is passed back to loading and the application exits
since that is the next line. What am I doing wrong/what can I adjust so
that control doesn't go back to loading when the form is minimized??
Plus, any tips on making that better are certainly welcome!
Thanks! 18 1766
"Derek Martin" <dm*****@DONTSP AMMEokstate.edu > schrieb Hi there, this is probably really dumb, but I am using a dialog as my main form and my startup form is my splash screen - which implements some progress bars to load up some relevant data. When that is done, loading form does this:
Me.Visible = False mainform.ShowDi alog() Application.Exi t()
So far so good (is this a dumb way of doing that???).
IMO not a good idea. You should only use a Form as the startup object if the
Form will always be visible from the start til the end of the application.
[...] Here is the problem: When I hit the ol minimize button on mainform, the application control is passed back to loading and the application exits since that is the next line. What am I doing wrong/what can I adjust so that control doesn't go back to loading when the form is minimized??
ShowDialog probably exits when the Form is minimized. If you change what
I've written above, this problem should have been solved also.
--
Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
I can live with that :-)
Any suggestions then on how to accomplish a splash screen in the main
form????
Thanks!
Derek
"Armin Zingler" <az*******@free net.de> wrote in message
news:40******** *************** @news.freenet.d e... "Derek Martin" <dm*****@DONTSP AMMEokstate.edu > schrieb Hi there, this is probably really dumb, but I am using a dialog as my main form and my startup form is my splash screen - which implements some progress bars to load up some relevant data. When that is done, loading form does this:
Me.Visible = False mainform.ShowDi alog() Application.Exi t()
So far so good (is this a dumb way of doing that???). IMO not a good idea. You should only use a Form as the startup object if
the Form will always be visible from the start til the end of the application.
[...] Here is the problem: When I hit the ol minimize button on mainform, the application control is passed back to loading and the application exits since that is the next line. What am I doing wrong/what can I adjust so that control doesn't go back to loading when the form is minimized??
ShowDialog probably exits when the Form is minimized. If you change what I've written above, this problem should have been solved also.
-- Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
"Derek Martin" <dm*****@DONTSP AMMEokstate.edu > schrieb I can live with that :-) Any suggestions then on how to accomplish a splash screen in the main form????
/In/ the main form or before showing the main form? I assume the latter:
shared sub main
dim splash as new splashform
dim main as mainform
splash.show
splash.refresh
main = new mainform
main.show
splash.close
application.run (main)
end sub
I only answered the question above - not the one with the NotifyIcon. ;-)
--
Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
This is the way I did my splash screen. It seems to work great.
This is the code in the main, startup form:
Private Sub Main_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
frmSplash = New frmSplash() ' my name for the form
frmSplash.ShowS plash()
' Apparently this method is available for a reason,
' so it may be better than the .ShowDialog method, etc.
' This is my own stuff for controling the splashscreen
' activity from this main form...
frmSplash.lstSp lash.Items.Add( "Loading... ")
' This is so above changes are displayed...
frmSplash.Refre sh()
' When you're done with the splashscreen...
frmSplash.Close ()
End Sub
Hope that helps.
Derek Martin wrote: Hi there, this is probably really dumb, but I am using a dialog as my main form and my startup form is my splash screen - which implements some progress bars to load up some relevant data. When that is done, loading form does this:
Me.Visible = False mainform.ShowDi alog() Application.Exi t()
So far so good (is this a dumb way of doing that???). Now, I am implementing a notification icon in mainform. Here is some relevant stuff:
(class variable shown as boolean = true and notify icon set up correctly)
Private Sub Open_Click(ByVa l sender As System.Object, ByVal e As System.EventArg s) Handles NotifyIcon1.Dou bleClick Me.WindowState = FormWindowState .Normal Me.ShowInTaskba r = True shown = True NotifyIcon1.Vis ible = False End Sub
Private Sub MainFormSizeCha nged(ByVal sender As Object, ByVal e As System.EventArg s) Handles MyBase.SizeChan ged If shown And Me.WindowState = FormWindowState .Minimized Then shown = False Me.ShowInTaskba r = False NotifyIcon1.Vis ible = True End If End Sub
Here is the problem: When I hit the ol minimize button on mainform, the application control is passed back to loading and the application exits since that is the next line. What am I doing wrong/what can I adjust so that control doesn't go back to loading when the form is minimized??
Plus, any tips on making that better are certainly welcome!
Thanks!
Thank you to both for your assistance. They have aided me in learning more
about the splashes, however, my particular case seems to be a bit different.
My splash screen uses a progress bar to actually show things as they are
being done on the mainform, loading up some objects, etc. I followed some
patterns from these posts and I get to a certain part that works well, but
it doesn't lend itself to threading very easily. For instance, in the
loading code, if I am referencing the mainform by an object instead of
creating it in the loading code (here I create it in the main method), I
cannot start up a thread on that object, I'd have to recreate it which beats
the purpose. I have attached my code if anyone can assist.
Thanks!
Derek
Public Class loading
Inherits System.Windows. Forms.Form
Dim elapsed As Short = 0
Dim t As Thread
Dim mainform As main
Private Sub StartTimer_Tick (ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles StartTimer.Tick
elapsed += 1
Me.Opacity = 1
If elapsed >= 10 Then
Me.StartTimer.E nabled = False
Me.beginLoading Components()
End If
End Sub
Private Sub Timer1_Tick(ByV al sender As System.Object, ByVal e As
System.EventArg s) Handles Timer1.Tick
Me.ProgressBar1 .Value += Me.ProgressBar1 .Maximum / 10
If Me.ProgressBar1 .Value >= Me.ProgressBar1 .Maximum Then
Timer1.Enabled = False
t.Join()
Me.Hide()
Me.Cursor = Cursors.Arrow
mainform.ShowDi alog(Me) 'INSTEAD OF DOING THIS, I need to pass
control to this form and dispose of this one...that way I can minimize to a
tray icon without exiting the app! Help!!!!
Application.Exi t()
End If
End Sub
Private Sub beginLoadingCom ponents()
Me.Timer1.Enabl ed = True
mainform = New main
t = New Thread(AddressO f mainform.gettin gstarted)
t.Start()
'mainform.getti ngstarted()
End Sub
Private Overloads Sub loading_Load(By Val sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Me.Cursor = Cursors.AppStar ting
Me.StartTimer.E nabled = True
End Sub
End Class
"Derek Martin" <dm*****@DONTSP AMMEokstate.edu > schrieb Thank you to both for your assistance. They have aided me in learning more about the splashes, however, my particular case seems to be a bit different.
My splash screen uses a progress bar to actually show things as they are being done on the mainform, loading up some objects, etc. I followed some patterns from these posts and I get to a certain part that works well, but it doesn't lend itself to threading very easily. For instance, in the loading code, if I am referencing the mainform by an object instead of creating it in the loading code (here I create it in the main method), I cannot start up a thread on that object, I'd have to recreate it which beats the purpose. I have attached my code if anyone can assist.
If you want an independent splash screen showing the progress, you need to
create it in it's own thread. I wouldn't create the Mainform in a different
thread.
Within Class Loading (example only):
public shared sub showInstance
dim t as thread
t = new thread(addresso f threadstart)
t.start
end sub
private sub threadstart
application.run (new loading)
end sub
Sub main would look like in my first example. If anything happens within the
Mainform that is to be displayed in the Splash Form, I'd raise an event in
the Mainform, handle it in the class/module containing sub main and update
the Splash Form in the event handler. But, when updating the splash Form,
you must use Begininvoke to do it because the event handler handling the
event from the Mainform is executed in the main thread, not in the thread
that created the Splash Form.
--
Armin
Thanks Armin, that went a little over my head, but I will investigate this
procedure, it sounds pretty good.
Quick question:
If the sub main() looks like your previous example, then where are you
executing showInstance in the loading class? In formload?
:-)
Derek
"Armin Zingler" <az*******@free net.de> wrote in message
news:40******** *************** @news.freenet.d e... "Derek Martin" <dm*****@DONTSP AMMEokstate.edu > schrieb Thank you to both for your assistance. They have aided me in learning more about the splashes, however, my particular case seems to be a bit different.
My splash screen uses a progress bar to actually show things as they are being done on the mainform, loading up some objects, etc. I followed some patterns from these posts and I get to a certain part that works well, but it doesn't lend itself to threading very easily. For instance, in the loading code, if I am referencing the mainform by an object instead of creating it in the loading code (here I create it in the main method), I cannot start up a thread on that object, I'd have to recreate it which beats the purpose. I have attached my code if anyone can assist. If you want an independent splash screen showing the progress, you need to create it in it's own thread. I wouldn't create the Mainform in a
different thread.
Within Class Loading (example only):
public shared sub showInstance dim t as thread t = new thread(addresso f threadstart) t.start end sub
private sub threadstart application.run (new loading) end sub
Sub main would look like in my first example. If anything happens within
the Mainform that is to be displayed in the Splash Form, I'd raise an event in the Mainform, handle it in the class/module containing sub main and update the Splash Form in the event handler. But, when updating the splash Form, you must use Begininvoke to do it because the event handler handling the event from the Mainform is executed in the main thread, not in the thread that created the Splash Form.
-- Armin
"Derek Martin" <dm*****@DONTSP AMMEokstate.edu > schrieb Thanks Armin, that went a little over my head, but I will investigate this procedure, it sounds pretty good. Quick question:
If the sub main() looks like your previous example, then where are you executing showInstance in the loading class? In formload?
:-)
Yes, like the previous example, the only difference is the call to
showInstance instead of Show. I renamed it afterwards.
--
Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Bruce Davis |
last post by:
I'm having a problem on windows (both 2000 and XP) with a multi-threaded
tkinter gui application. The problem appears to be a deadlock condition
when a child thread pops up a
Pmw dialog window in the context of a main window. The problem does not
occur on HPUX or Linux. The following simple example code illustrates
the problem and the...
|
by: calan |
last post by:
I need a dialog box with Yes, No, and Cancel buttons that pops up when a
link is clicked.
I'm using asp on the server side, and basically, if the user clicks yes, I
want to go to a certain page and pass a certain variable value. For example:
href="my_page.asp?answer=yes"
If they click no, I would call :
|
by: Marian Heddesheimer |
last post by:
Hi,
I have a C# main form which creates a new non-modal Dialog. From the
modal Dialog I can update data via a public attribute from the Dialog,
but how do I notify the main window that data has changed?
In MFC I just used SendMessage to send a WM_NOTIFY. Is there an
equivalent in plain c# or can I use another method to notify the main...
|
by: Dennis C. Drumm |
last post by:
This is a restatement of an earlier post that evidently wasn't clear. I am
building a custom MessageBox dialog that has, among other things, a few new
button options (yes to all, no to all, etc.) and would like to make the
dialog look and act like the standard MessageBox. Therefore, I would like to
put in the message section the same type of...
|
by: Zeljko |
last post by:
Hi,
I have a form with a tray icon. However, when I minimize the form, it
stays visible - not in the task bar (I have showintaskbar property set
to false), but in a form of a rectangle sitting above the task bar.
Can't figure out why that happens - it looks very ugly...
Any ideas ?
Zeljko
| |
by: jm |
last post by:
Hi,
I have a C# program that changes the notifyIcon during the program.
What I have noticed is that sometimes when the program is over the old
icon will still be in the system tray. But when i move over the icons
in the taskbar the taskbar will immediately update itself and clear
the old icon away.
I was just wondering if this is normal...
|
by: Opa |
last post by:
I have tried for two days to solve this problem with no luck.
I have a singleton class which has some events declared. When I inherit
from this class the events don't seem to come along with it.
The event in the singleton class always evaluates to null even when I cleary
subscribe to it.
Does anyone have some sample code of how to do...
|
by: james |
last post by:
My app has a notify Icon, but after the app exits, the Icon is still
visible, and then when I runthe app multiple times I get multiple icons so
that my status bas keeps accumulating them to the point it becomes
un-usable. The only fix I have found is to re-boot. Not a godd solution.
How do I get this to stop happening?
Environment C#,...
|
by: Vittorio Pavesi |
last post by:
Hello,
I'm using a notify icon and I'm trying to add icons on my menu, I took a
look on
http://msdn.microsoft.com/msdnmag/issues/04/02/CuttingEdge/default.aspx but
on the bottom of the page there is a bug
http://support.microsoft.com/?id=827043 saying that it doesn't work with
notify icon.
Anybody has got a workaround ?
Vittorio
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |