Problems in VB.net?

mythinky

Member
Joined
Jun 4, 2004
Messages
20
Programming Experience
1-3
Helo, this is some problems occurs. Anyone can help?
1. How to get the current directory of the application.exe when I installed the application?
2. For "shell" command, if i am calling app.exe, do i need to specify the path?
3. How to make the close button to be hide button. I mean the close button that come with VB.Net is automatically function as close the form, i want to change it into hide button, which hide the form. How could i do that?
4. I have specified a form that the showintaskbar to false and the windowstate to minimized, but when i click the notify icon, which is set the showintaskbar to true and windowstate to normal, it only works for the showintaskbar, it doesn't work for windowstate. The form won't display unless i set to maximize. How can be like this?
Thanks...
 

vbkev

Active member
Joined
Jun 4, 2004
Messages
32
Location
Newcastle, UK
Programming Experience
5-10
1. Application.StartupPath
2. It should assume the current directory but it is good practice to specify the directory
 

vbkev

Active member
Joined
Jun 4, 2004
Messages
32
Location
Newcastle, UK
Programming Experience
5-10
3. This code should work:
e.Cancel = True

Me.WindowState = FormWindowState.Minimized

 

Paszt

Staff member
Joined
Jun 3, 2004
Messages
1,500
Location
Raleigh, NC - USA
Programming Experience
Beginner
Regarding 3. I suppose you mean to put 'e.Cancel = True ...' in the closing event handler of the form. When you do that, you'll never be able to shutdown, the app won't close.

I've seen examples of using messaging to determine if the close was issued by the close button or the system. Is there a more elegant way to do this? If not, anyone have example code for the messaging (can't find it anymore).
 

vbkev

Active member
Joined
Jun 4, 2004
Messages
32
Location
Newcastle, UK
Programming Experience
5-10
yeah sorry i forgot to say that was for the closing event.

what i generally tend to do is create a member variable
Private mbClose As Boolean = False

In my Closing Event Handler

If mbClose = False Then
e.Cancel = True
Me.WindowState = FormWindowState.Minimized
End If

Finally, i would have an Exit menu that set mbClose = True then exit the app. That way only my Exit menu could close the app.
 
Top Bottom