473,761 Members | 9,474 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problems Showing Main Form after Hide

I have a Main Form that hides in the Task Bar Tray as an Icon until
one of the Tray Icon's Menu Items is selected. (think of your
antivirus program running there)

The program starts up fine and shows the main form fine, but once I
tell it to hide, it does not want to show back up later.

What could my problem be?

Here is my code:

Public Sub ShowMe(ByVal val As Boolean)
TopMost = False
If (val = True) Then
WindowState = FormWindowState .Normal
Show()
ShowInTaskbar = True
TopMost = True
ElseIf (val = False) Then
WindowState = FormWindowState .Minimized
Hide()
ShowInTaskbar = False
End If
Refresh()
Application.DoE vents()
End Sub
Jun 27 '08 #1
2 2006

"jp2group" <tj****@gmail.c omwrote in message
news:c7******** *************** ***********@m3g 2000hsc.googleg roups.com...
>I have a Main Form that hides in the Task Bar Tray as an Icon until
one of the Tray Icon's Menu Items is selected. (think of your
antivirus program running there)

The program starts up fine and shows the main form fine, but once I
tell it to hide, it does not want to show back up later.

What could my problem be?

Here is my code:

Public Sub ShowMe(ByVal val As Boolean)
TopMost = False
If (val = True) Then
WindowState = FormWindowState .Normal
Show()
ShowInTaskbar = True
TopMost = True
ElseIf (val = False) Then
WindowState = FormWindowState .Minimized
Hide()
ShowInTaskbar = False
End If
Refresh()
Application.DoE vents()
End Sub

This is code I use

Private Sub NotifyIcon1_Dou bleClick(ByVal sender As Object, ByVal e As
System.EventArg s) Handles NotifyIcon1.Dou bleClick
If Me.WindowState = FormWindowState .Minimized Then
Me.WindowState = FormWindowState .Maximized
Me.NotifyIcon1. Visible = False
End If
Me.Show()
Me.Activate()
End Sub

Hope this helps
LS

Jun 27 '08 #2
In case your form is not intended to be maximized, which is somewhat
rare, in my experience:

Private Sub NotifyIcon_Doub leClick(ByVal sender As Object, ByVal e As
System.EventArg s) Handles NotifyIcon.Doub leClick
Me.Show()
Application.DoE vents()
Me.WindowState = FormWindowState .Normal
Me.Focus()
End Sub

Using the code, below, maximizes the form. Changing "maximize" to
"normal" also has a problem of leaving the form a small, unusable thing
down in the corner.

The DoEvents, above, is probably redundant.

Mike
On Sat, 19 Apr 2008 10:57:21 -0400, in
microsoft.publi c.dotnet.langua ges.vb "Lloyd Sheen" <a@b.cwrote:
>
"jp2group" <tj****@gmail.c omwrote in message
news:c7******* *************** ************@m3 g2000hsc.google groups.com...
>>I have a Main Form that hides in the Task Bar Tray as an Icon until
one of the Tray Icon's Menu Items is selected. (think of your
antivirus program running there)

The program starts up fine and shows the main form fine, but once I
tell it to hide, it does not want to show back up later.

What could my problem be?

Here is my code:

Public Sub ShowMe(ByVal val As Boolean)
TopMost = False
If (val = True) Then
WindowState = FormWindowState .Normal
Show()
ShowInTaskbar = True
TopMost = True
ElseIf (val = False) Then
WindowState = FormWindowState .Minimized
Hide()
ShowInTaskbar = False
End If
Refresh()
Application.DoE vents()
End Sub


This is code I use

Private Sub NotifyIcon1_Dou bleClick(ByVal sender As Object, ByVal e As
System.EventAr gs) Handles NotifyIcon1.Dou bleClick
If Me.WindowState = FormWindowState .Minimized Then
Me.WindowState = FormWindowState .Maximized
Me.NotifyIcon1. Visible = False
End If
Me.Show()
Me.Activate()
End Sub

Hope this helps
LS
Jun 27 '08 #3

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

Similar topics

1
3737
by: Daniel Hill | last post by:
OK, I have very, VERY basic background knowledge of VB6 and have now upgraded to VB.NET and now I'm struggling to bring up the forms I want. What I am looking to do is to have a click a command button bring up a form, and to have which form is brought up determined by which item is selected in the accompanying combo box. I've gathered that you have to declare the item as a
13
40762
by: Dan R Brown | last post by:
I have a large form that is generated dynamically in a jsp using xml / xslt. So, to break up this form into several "tabbed" sections, I break up the form using <div> tags. Each <div style="display:none"> can be displayed by setting the style attribute to "display:", or hidden with "display:none". This gives the illusion that the person filling out the form is switching from page to page...without the overhead of extra hits on the server,...
7
6900
by: Danielb | last post by:
I want my application to run most of the time as just an notify icon visible in the system tray, with some dialogs windows that open if the user selects an option from the context menu on the tray icon. I've had a look at the example on code project that creates an application that runs in the system tray: http://www.codeproject.com/csharp/desktop_mail_checker.asp So I copied how the above article sets up the main form: the form's...
6
1162
by: John Dann | last post by:
I have a main form and then a secondary form that allows entry of some settings. I want to show the secondary form modally (I guess using ..ShowDialog), but I'd like it shown against the background of the main form. At present using frm2.showdialog eg from a main form menu click causes the main form to disappear from the background, which is a little disorientating for the user. Is this the standard behaviour of ShowDialog or have I got...
8
1366
by: Adam Honek | last post by:
Hello, I have an app that starts in sub main() I am making a new instance of a form so it can be displayed. It compiles fine but when the program is run the form shows up but then a split second later closes itself. Why is this?
3
2756
by: google | last post by:
I'm developing an application for use within my company in Access 2003. I'm new to '03, the application I did for my former employer was in '97. The two applications have similar functionality (we're sales offices, and I'm doing things such as associate directories, commission calculations, order tracking, etc.). 2003 seems to have a few extra features, but I seem to continually run in to oddities that seem like they SHOULD work, but...
4
1486
by: Ron | last post by:
I am having a bit of problem with this code: Dim cmd As New OleDb.OleDbCommand("INSERT INTO help (Name, Email, telephone, description)VALUES('" & txtName.Text & "','" & txtEmail.Text & "','" & txtTelephone.Text & "','" & txtDescription.Text & "')", New OleDb.OleDbConnection(strconn)) at the end, strconn is underlined in blue and says not defined, I dont know what to do with this, how do I define it?
24
2966
by: allpervasive | last post by:
hi all, this is reddy, a beginner to c lang,,here i have some problems in reading and modifying the contents of a file,, hope you can help to solve this problem. Here i attach the file to be modified and the program code. In the attached file below i just want to change the value of data(only float value) after the line 1 P V T 1 15 till 2 G TT, from positive to negative and vice versa, and wire the date in other file. can someone help...
0
9554
marktang
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9376
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
10136
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9988
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
9811
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...
0
6640
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5266
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
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2788
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.