473,625 Members | 2,628 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Test for windows hide

Hi
I have an application with 3 windows forms. One of which I load at startup
but hide, then show/hide based on users click. How can I test to see if the
windows is hidden, or is at the moment being shown?

Thanks
BrianDH
Nov 21 '05 #1
4 1553
I assume you're loading the "Startup" form from sub_main?

I do something simular for a splash screen.

I'll just copy the class here, but you should get the point... In SubMain I
call Splash.Show
And later in the app I can Splash.Close, you should be able to do something
simular to get SpecialForm.Vis ible.

---------------------------------------------------------
Public Class Splash
Private Shared splashForm As SplashScreen
Private Shared splashThread As Thread
Shared Sub ShowThread()
If splashForm Is Nothing Then
splashForm = New SplashScreen
End If
Application.Run (splashForm)
End Sub

Public Shared Sub Show()
If Not splashThread Is Nothing Then
Return
End If

splashThread = New Thread(New ThreadStart(Add ressOf
Splash.ShowThre ad))
splashThread.Cu rrentCulture =
Thread.CurrentT hread.CurrentCu lture
splashThread.Cu rrentUICulture =
Thread.CurrentT hread.CurrentUI Culture
splashThread.Is Background = True
splashThread.Ap artmentState = ApartmentState. STA
splashThread.St art()
While splashForm Is Nothing
Thread.Sleep(Ne w TimeSpan(100))
End While

End Sub

Public Shared Sub Close()
If splashThread Is Nothing Then Return
If splashForm Is Nothing Then Return

Try
If splashForm.IsDi sposed Then Return
If splashForm.Hand le.Equals(IntPt r.Zero) Then Return
splashForm.Invo ke(New MethodInvoker(A ddressOf
splashForm.Clos e))
Catch ex As Exception
Logger.AddLogEx ception(ex,
System.Reflecti on.MethodBase.G etCurrentMethod ().DeclaringTyp e.ToString)
splashThread = Nothing
splashForm = Nothing
End Try
End Sub

Public Shared Property Status() As String
Get
If splashForm Is Nothing Then Throw New
InvalidOperatio nException("Spl ash Form not on screen")
Return splashForm.Stat usInfo
End Get
Set(ByVal Value As String)
If splashForm Is Nothing Then Return
splashForm.Stat usInfo = Value
End Set
End Property

Public Shared Property Version() As String
Get
If splashForm Is Nothing Then Throw New
InvalidOperatio nException("Spl ash Form not on screen")
Return splashForm.Vers ionInfo
End Get
Set(ByVal Value As String)
If splashForm Is Nothing Then Return
splashForm.Vers ionInfo = Value
End Set
End Property

Private Sub New()

End Sub
End Class

Create a public property in the form you want to show or hide that does
visibility...
Public Property Visible As Boolean

"BrianDH" <Br*****@discus sions.microsoft .com> wrote in message
news:34******** *************** ***********@mic rosoft.com...
Hi
I have an application with 3 windows forms. One of which I load at
startup
but hide, then show/hide based on users click. How can I test to see if
the
windows is hidden, or is at the moment being shown?

Thanks
BrianDH

Nov 21 '05 #2
Hi Jeff

The issues is not creating the form and or checking for its creation.
The issues is checking to see if the form's state is visable/shown or
hidden.
The application starts with a MAIN form. Within the Main form I create a
2nd form but hide it. I am looking for a way to know when the user is
viewing / has the 2nd form shown or if it is currently hidden.

Thanks

"Jeff Sheldon" wrote:
I assume you're loading the "Startup" form from sub_main?

I do something simular for a splash screen.

I'll just copy the class here, but you should get the point... In SubMain I
call Splash.Show
And later in the app I can Splash.Close, you should be able to do something
simular to get SpecialForm.Vis ible.

---------------------------------------------------------
Public Class Splash
Private Shared splashForm As SplashScreen
Private Shared splashThread As Thread
Shared Sub ShowThread()
If splashForm Is Nothing Then
splashForm = New SplashScreen
End If
Application.Run (splashForm)
End Sub

Public Shared Sub Show()
If Not splashThread Is Nothing Then
Return
End If

splashThread = New Thread(New ThreadStart(Add ressOf
Splash.ShowThre ad))
splashThread.Cu rrentCulture =
Thread.CurrentT hread.CurrentCu lture
splashThread.Cu rrentUICulture =
Thread.CurrentT hread.CurrentUI Culture
splashThread.Is Background = True
splashThread.Ap artmentState = ApartmentState. STA
splashThread.St art()
While splashForm Is Nothing
Thread.Sleep(Ne w TimeSpan(100))
End While

End Sub

Public Shared Sub Close()
If splashThread Is Nothing Then Return
If splashForm Is Nothing Then Return

Try
If splashForm.IsDi sposed Then Return
If splashForm.Hand le.Equals(IntPt r.Zero) Then Return
splashForm.Invo ke(New MethodInvoker(A ddressOf
splashForm.Clos e))
Catch ex As Exception
Logger.AddLogEx ception(ex,
System.Reflecti on.MethodBase.G etCurrentMethod ().DeclaringTyp e.ToString)
splashThread = Nothing
splashForm = Nothing
End Try
End Sub

Public Shared Property Status() As String
Get
If splashForm Is Nothing Then Throw New
InvalidOperatio nException("Spl ash Form not on screen")
Return splashForm.Stat usInfo
End Get
Set(ByVal Value As String)
If splashForm Is Nothing Then Return
splashForm.Stat usInfo = Value
End Set
End Property

Public Shared Property Version() As String
Get
If splashForm Is Nothing Then Throw New
InvalidOperatio nException("Spl ash Form not on screen")
Return splashForm.Vers ionInfo
End Get
Set(ByVal Value As String)
If splashForm Is Nothing Then Return
splashForm.Vers ionInfo = Value
End Set
End Property

Private Sub New()

End Sub
End Class

Create a public property in the form you want to show or hide that does
visibility...
Public Property Visible As Boolean

"BrianDH" <Br*****@discus sions.microsoft .com> wrote in message
news:34******** *************** ***********@mic rosoft.com...
Hi
I have an application with 3 windows forms. One of which I load at
startup
but hide, then show/hide based on users click. How can I test to see if
the
windows is hidden, or is at the moment being shown?

Thanks
BrianDH


Nov 21 '05 #3
Why not just set a private variable to true whenever the 2nd form is shown.
"BrianDH" <Br*****@discus sions.microsoft .com> wrote in message
news:A5******** *************** ***********@mic rosoft.com...
Hi Jeff

The issues is not creating the form and or checking for its creation.
The issues is checking to see if the form's state is visable/shown or
hidden.
The application starts with a MAIN form. Within the Main form I create a
2nd form but hide it. I am looking for a way to know when the user is
viewing / has the 2nd form shown or if it is currently hidden.

Thanks

"Jeff Sheldon" wrote:
I assume you're loading the "Startup" form from sub_main?

I do something simular for a splash screen.

I'll just copy the class here, but you should get the point... In SubMain
I
call Splash.Show
And later in the app I can Splash.Close, you should be able to do
something
simular to get SpecialForm.Vis ible.

---------------------------------------------------------
Public Class Splash
Private Shared splashForm As SplashScreen
Private Shared splashThread As Thread
Shared Sub ShowThread()
If splashForm Is Nothing Then
splashForm = New SplashScreen
End If
Application.Run (splashForm)
End Sub

Public Shared Sub Show()
If Not splashThread Is Nothing Then
Return
End If

splashThread = New Thread(New ThreadStart(Add ressOf
Splash.ShowThre ad))
splashThread.Cu rrentCulture =
Thread.CurrentT hread.CurrentCu lture
splashThread.Cu rrentUICulture =
Thread.CurrentT hread.CurrentUI Culture
splashThread.Is Background = True
splashThread.Ap artmentState = ApartmentState. STA
splashThread.St art()
While splashForm Is Nothing
Thread.Sleep(Ne w TimeSpan(100))
End While

End Sub

Public Shared Sub Close()
If splashThread Is Nothing Then Return
If splashForm Is Nothing Then Return

Try
If splashForm.IsDi sposed Then Return
If splashForm.Hand le.Equals(IntPt r.Zero) Then Return
splashForm.Invo ke(New MethodInvoker(A ddressOf
splashForm.Clos e))
Catch ex As Exception
Logger.AddLogEx ception(ex,
System.Reflecti on.MethodBase.G etCurrentMethod ().DeclaringTyp e.ToString)
splashThread = Nothing
splashForm = Nothing
End Try
End Sub

Public Shared Property Status() As String
Get
If splashForm Is Nothing Then Throw New
InvalidOperatio nException("Spl ash Form not on screen")
Return splashForm.Stat usInfo
End Get
Set(ByVal Value As String)
If splashForm Is Nothing Then Return
splashForm.Stat usInfo = Value
End Set
End Property

Public Shared Property Version() As String
Get
If splashForm Is Nothing Then Throw New
InvalidOperatio nException("Spl ash Form not on screen")
Return splashForm.Vers ionInfo
End Get
Set(ByVal Value As String)
If splashForm Is Nothing Then Return
splashForm.Vers ionInfo = Value
End Set
End Property

Private Sub New()

End Sub
End Class

Create a public property in the form you want to show or hide that does
visibility...
Public Property Visible As Boolean

"BrianDH" <Br*****@discus sions.microsoft .com> wrote in message
news:34******** *************** ***********@mic rosoft.com...
> Hi
> I have an application with 3 windows forms. One of which I load at
> startup
> but hide, then show/hide based on users click. How can I test to see
> if
> the
> windows is hidden, or is at the moment being shown?
>
> Thanks
> BrianDH


Nov 21 '05 #4
Yes, i can do that. This question was more for just information, was not
like I was stuck, just was wondering.

Thanks

"Jeff Sheldon" wrote:
Why not just set a private variable to true whenever the 2nd form is shown.
"BrianDH" <Br*****@discus sions.microsoft .com> wrote in message
news:A5******** *************** ***********@mic rosoft.com...
Hi Jeff

The issues is not creating the form and or checking for its creation.
The issues is checking to see if the form's state is visable/shown or
hidden.
The application starts with a MAIN form. Within the Main form I create a
2nd form but hide it. I am looking for a way to know when the user is
viewing / has the 2nd form shown or if it is currently hidden.

Thanks

"Jeff Sheldon" wrote:
I assume you're loading the "Startup" form from sub_main?

I do something simular for a splash screen.

I'll just copy the class here, but you should get the point... In SubMain
I
call Splash.Show
And later in the app I can Splash.Close, you should be able to do
something
simular to get SpecialForm.Vis ible.

---------------------------------------------------------
Public Class Splash
Private Shared splashForm As SplashScreen
Private Shared splashThread As Thread
Shared Sub ShowThread()
If splashForm Is Nothing Then
splashForm = New SplashScreen
End If
Application.Run (splashForm)
End Sub

Public Shared Sub Show()
If Not splashThread Is Nothing Then
Return
End If

splashThread = New Thread(New ThreadStart(Add ressOf
Splash.ShowThre ad))
splashThread.Cu rrentCulture =
Thread.CurrentT hread.CurrentCu lture
splashThread.Cu rrentUICulture =
Thread.CurrentT hread.CurrentUI Culture
splashThread.Is Background = True
splashThread.Ap artmentState = ApartmentState. STA
splashThread.St art()
While splashForm Is Nothing
Thread.Sleep(Ne w TimeSpan(100))
End While

End Sub

Public Shared Sub Close()
If splashThread Is Nothing Then Return
If splashForm Is Nothing Then Return

Try
If splashForm.IsDi sposed Then Return
If splashForm.Hand le.Equals(IntPt r.Zero) Then Return
splashForm.Invo ke(New MethodInvoker(A ddressOf
splashForm.Clos e))
Catch ex As Exception
Logger.AddLogEx ception(ex,
System.Reflecti on.MethodBase.G etCurrentMethod ().DeclaringTyp e.ToString)
splashThread = Nothing
splashForm = Nothing
End Try
End Sub

Public Shared Property Status() As String
Get
If splashForm Is Nothing Then Throw New
InvalidOperatio nException("Spl ash Form not on screen")
Return splashForm.Stat usInfo
End Get
Set(ByVal Value As String)
If splashForm Is Nothing Then Return
splashForm.Stat usInfo = Value
End Set
End Property

Public Shared Property Version() As String
Get
If splashForm Is Nothing Then Throw New
InvalidOperatio nException("Spl ash Form not on screen")
Return splashForm.Vers ionInfo
End Get
Set(ByVal Value As String)
If splashForm Is Nothing Then Return
splashForm.Vers ionInfo = Value
End Set
End Property

Private Sub New()

End Sub
End Class

Create a public property in the form you want to show or hide that does
visibility...
Public Property Visible As Boolean

"BrianDH" <Br*****@discus sions.microsoft .com> wrote in message
news:34******** *************** ***********@mic rosoft.com...
> Hi
> I have an application with 3 windows forms. One of which I load at
> startup
> but hide, then show/hide based on users click. How can I test to see
> if
> the
> windows is hidden, or is at the moment being shown?
>
> Thanks
> BrianDH


Nov 21 '05 #5

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

Similar topics

3
2859
by: Sam | last post by:
I wrote a script to show or hide items in an HTML list (<ul id="stuff">) depending on whether a list-item's CLASS attribute matches an input string (catString), which is chosen from a SELECT menu. Can anyone suggest any improvements to this (below)? I'm a JS beginner. It seems to work Camino/Firefox and Mac Explorer-5, but not in Safari. I haven't been able to test it in
30
2292
by: Kelsey Bjarnason | last post by:
I'm online at the moment, trying to help someone with a programming problem. His code, which isn't as bad as it could be, is trying to open a file "file.in". The file exists, is called "file.in" and is in the right place - but the code won't open it - can't find the file. Say what? Can't find the file? But it's right there, with the right name, so why can't it find it?
5
6578
by: Xarky | last post by:
Hi, I am creating a windows form, and when a specified event occurs (button click), I am hiding the windows form and opening a new windows form. When opening the new windows form and closing it, the main windows form would still be running in the background and never terminating. How can I terminate the old window form from the new created window. I hope someone out there understands my problem.
1
355
by: Asad | last post by:
Hi, I am trying to write my first Windows application using VB.NET and I am having some difficulties designing the UI. Basically its one Windows Form with 4 menus on the top (no drop downs). When you click on any of the menu the UI changes. For instance clicking on the first menu shows a bunch of textboxes allowing the user to enter some information and click a button. The next menu will let user choose a file from a dropdown menu and...
3
3970
by: jab3 | last post by:
Hello. I"m new to this group, and to JavaScript in general, so please forgive me if I breach local etiquette. I'm trying to implement some client-side 'dynamic' validation on a form. I'm having a couple of problems, which I'll try to describe. But this e-mail will only reproduce one of them, in a "short" example. What I'm generally doing is having each form entry contained in a div, which as a label, an input with some event handlers,...
2
3925
by: Rain | last post by:
Does anyone know the code in C# or snippet or API so i can hide and show the windows taskbar? Many people have suggested using ShowWindow and FindWindow or the ABM_SETSTATE but i am having problem with the code. Cant seem to make it work. Would really appreciate any code given.. Thank you so much! I really need this one. Thank you in advance. Hiding and showing of windows taskbar or the auto-hide property of the taskbar will do. Thank...
7
1754
by: Steve954 | last post by:
I recently installed and started using VS2005 on a Windows XP Pro machine. When creating a new windows forms project I find that I am unable to hide any forms using the me.hide() or me.visible = False methods. As far as I can tell these methods are available and should work in VB2005. Any help and advise would be great as this is causing be a number of problems of two new projects I am working on. Many Thanks
2
5071
by: emily224 | last post by:
Hello, I have been trying to understand this source code, which I retreived from my online course test. I would like to know how to find the answer for the question on the test. Im sure the answer must be embedded somewhere in the source code, and I would like to know if anyone knows where to find the correct answer. I would greatly appreciate it!! Thanks!! <!--put the preloads file here as it must load before the website class...
4
68174
by: emily224 | last post by:
Hello, I have been trying to understand this source code, which I retreived from my online course test. I would like to know how to find the answer for the question on the test. Im sure the answer must be embedded somewhere in the source code, and I would like to know if anyone knows where to find the correct answer. I would greatly appreciate it!! Thanks!!
0
8182
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8635
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8494
tracyyun
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6115
isladogs
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4085
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4188
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2614
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
1
1800
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1496
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.