.net - Closing Main Form Doesn't Finish Process In Windows 7?
Feb 23, 2011
I have an MDI form as the app start object.I don't think is related, but in the Form closing event, I check for some condition, and if it's true, I ask for confirmation before closing:
Private Sub FormBackground_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
If (e.CloseReason = CloseReason.UserClosing) Then[code].....
So long, everything works fine in my development machine, which runs windows XP.However, when deploying the application in a windows 7 machine, the message box works correctly, showing itself whenever it should, but after the form is closed the application keeps running in the background. This happens whether the form closes directly or asks the user first.I have fixed it putting an End instruction in the FormBackground.FormClosed event, but it doesn't feel good.
View 4 Replies
ADVERTISEMENT
Jun 4, 2010
Dim frm As Form
For Each frm In Forms
Set frm = Nothing
Next frm
The above code is what I used in VB6 to close all forms associated with my programs before my program closed. I have been searching for information on how to make sure all forms are closed when closing a VB2008 program.
I have seen info on using the Project Property Shutdown mode When startup form closes and I currently have this set.
Is this all that is really necessary? Will the garbage disposal close everything else to free up RAM?
Also, if I have several forms open and want to close all from the main form without closing each one individually, what is the best approach? Is there a collection like in VB6, go through the collection, compare it to the name of the main form and close it if it is not the main form?
View 4 Replies
May 12, 2009
I am trying to use a progressbar to show on main form and then finish when next form is loaded, I have got this code.
1. When I click on button, it must open next form, but the next form must only open when the data in my list box has been loaded from Access Databse. When I run my program, it only shows the progressbar and don't open the next form.
Main form code:
Public Class Main
Dim PB As ProgressBar
Private Sub main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
[CODE]............................
View 4 Replies
Jul 20, 2010
I need to access the current instance of MS Excel. To do that, I wrote the following code:
Imports Excel = Microsoft.Office.Interop.Excel
Imports System.Diagnostics
Private _ExcelApp As Excel.Application
[Code].....
The code runs nice, but it has a problem: After the user close the Excel application (click button X - note: no other instance of Excel exists), if you open the Windows's task manager, its possible to see the process Excel.exe.
If I open and close the Excel application, there is no process Excel.exe, but if I run my code with the Excel application openned, after the user close the Excel application, the process Excel.exe isn't finished.
View 2 Replies
Apr 3, 2009
Ok i have a login window which connects to a MySQL database and authenticates the user. Works perfect, BUT
If rowsEffected > 0 Then
cnMySQL.Close()
LoginForm1.Close()
MainForm.Show()
Else
cnMySQL.Close()
MsgBox("Login Failed!")
End If
That's supposed to close the login form and open the main form if the query returned a positive match of the login information. The login works, closes the login form, opens the main form, than mysteriously exits the application. I'm guessing its something simple but i don't see it .. the main form has nothing in it besides some inputs and labels no subs at all and if i change the form which the program starts to to the main form it runs as designed.
I know usually if you start your program from a module and use Application.Run() you can keep the thread open, but this is all forms no background work so i didn't want to go that direction.P.S. i just removed LoginForm1.Close() and it logs me in fine and opens the main form fine and keeps the app running but the login form is still open.
View 5 Replies
Mar 10, 2012
Everytime I execute my program, the main form closes by itself after about 15 seconds. The code is not the problem because it does the same thing when I put the whole code in comments. It's also not a key problem because it closes by itself even when I don't touch a single key when it's running.
View 1 Replies
Jun 12, 2009
I need to reload the form of my application. The application has only one form vb.net 2005. I need a button that will call the page_load event so I can restart and reload all my settings. basically I need to call the Sub private Page_load event().I just need to force the reloading of the form without having to close it and reopen it.This is the code which I need to reload:
Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
For Each URLname As String In My.Settings.URLtoTrackCollection
URLtoTrack.Add(URLname)
[code]....
View 8 Replies
Jan 27, 2011
I have created a splash screen and it fades in. When the splash screen closes, the main form (MDI) should open. The main form opens but then immediately closes.
vb
Public Class frmSplash
Private Sub frmSplash_FormClosing(ByVal sender As Object, _
ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
'Open the MDI form.
frmMain.Show()
End Sub
[Code] .....
View 3 Replies
Jun 1, 2012
I'm having a problem with closing Acrobat. I'm using vb.net to sign a PDF file in running Acrobat. After I'm done I close Acrobat and try to delete the currently signed PDF file, but I get an error message telling me that file is being used by another process. I tried closing and setting to Nothing AcroApp, AcroAVDoc, AcroPDDoc JSO, but still that doesn't work. I tried releasing them with Marshal.ReleaseComObject(...) still no effect.[code]
View 1 Replies
Apr 29, 2010
I am working on a program and for some reason when I run it as an executable outside of debug mode, if I run the main subroutine of the program, the process remains in memory after being closed. Even though the form is closed/gone, it will be in the process list and I have to ctl-alt-del to remove it. If I exit right after opening the form without doing anything, it closes like normal. I am closing and disposing everything I can think of, and I've never had this problem before. This is how I am exiting, but the problem also occurs if the user "X's" out.
Me.Close()
Application.Exit()
I have a couple web file requests in my program, which is the only thing out of the ordinary (code-wise) for me, don't know if those are the root of the problem. I can't imagine this is the first time this has happened to anyone, but I couldn't find anything helpful with my search terms. Any ideas/common solutions? I can post sections of my code if it will help, but the whole thing is pretty long and I couldn't narrow down any potential problem areas.
View 12 Replies
Mar 11, 2010
During search Process My Form "Stop Respond" Like "Hang" Until Finish Search Process.I want to add Images apiece - ly or One by one (like progressbar)
My text code is :
[code]...
and how can i ignore System Protected Folders Like "System Volume Information" During Search Process.
View 15 Replies
Feb 14, 2012
I have a MultiThreading issue and conceptual question using Visual Basic (but it applies to almost all languages). [code]...
View 2 Replies
Apr 23, 2009
I need to quickly demonstrate a project and decided to create a user control that is connected to an Access database through pure simple data connections (create the dataset and drag it on the control.)When I build the project and add the usercontrol to panel control on the main form, no data is shown in the datagrid.When I add the data components directly on the main form, the data is displayed properly. why I can't get my databound user control to display the data on my main form?
View 2 Replies
Jan 4, 2012
I'm developing Applications in VB.NET 2008.
I have MDI Parent Form and i'm going load all form as MDI child. Here i'm going to give option to "Close All" toolstripbutton in top of MDI Parent to close All mdi child forms.
Now i would like to check that On click of Close All Toolstripbutton , i have to close all mdi child form but except those form is on process, example, I have opened/Loaded 5 MDI child forms within MDI Parent Form.
Child forms are ( just for example ) ,
1. Customer details Form
2. Item Details Form
3. Import Orders Form
4. Stock Details Form
5. Production Entry Form
Here 3.Import Orders form is importing from Excel with 5000 records and 4. Stock details form exporting to excel.
So now if i click "Close All" button then i have close only Idle form i.e 1,2 and 5 but i should not close 3 and 4 since its on some process.
So Is there any .NET option to check that form in process/idle or do I have to check manually by having any Flags ?
View 1 Replies
May 17, 2011
I am usng a multi threaded process to fire off a task, but when it is completed I want to make a label visible on the main form (form 1), eg "process completed", however the code I have in place comes up with the following error message;
Cross-thread operation not valid: Control 'lblCompleted' accessed from a thread other than the thread it was created on.
View 4 Replies
Jan 19, 2011
I been trying to do loop until and while and even waitforexit nothing works as far as I did not really good with loops.[code]
View 7 Replies
Dec 31, 2009
i want to check if a certain form is loaded and if so then close it from another form.
View 3 Replies
Mar 12, 2010
how I can reload a windows form without closing it using VB.NET?
View 3 Replies
Aug 15, 2010
I had created a windows forms application in vb.net. It contained several windows. Now the users of that application are telling me to display all in one main form. They want to see all the details in one form. I had implemented MDI but they want something like tabs. On different tabs different forms should be displayed. How shall I implement this.
View 4 Replies
Aug 29, 2011
Can you kindly tell me why I am getting a runtime exception when trying to run this code?
[Code]...
View 1 Replies
Mar 7, 2011
I'm currently making a Computer Cleaner, my program launch's rundll32.exe's to clean IE's history.
Like to clear the add-on settings I would put:
Shell("RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 4351")
But I need to wait for it to wait before letting it to go on to the next thing like clear cookies, which would be: Shell("RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2")
View 3 Replies
Feb 21, 2011
I have a program that starts another program after setting the regkeys basically the program continually syncs the calandar of outlook and another application.I set the regkeys than launch the c:sync.exe app. I have tried a simple process.start and launching the process as a thread and they both do the same thing: The other process starts and works as it should but my main program goes "White screen" or "not responding" until the process.start has exited.
I want the process.start to run in the background so if users click in my main app it responds and truly that they can access the context menu of my main app from the taskbar while the process.start is running.
View 5 Replies
Dec 22, 2011
I am confused what will happen, when I disable a timer. Will it finish the process and then disable or will it immediately disable without completing process? for example
[Code]....
I want to run getMessage from somewhere else, so I need to disable timer during that time to be asured not to override anything and also before timer disable it should complete that function code.
View 3 Replies
Jan 24, 2012
VB Windows form Application.. I am developing an application of which part of the program is around configuration settings allowing the user to enter configuration items. When the menubar item for configuration menu is clicked on the main form the menu opens.This is fine but the mainform should not become active again until the configuration menu has closed. This does not happen right now and the mainform simply comes to the foreground and the configuration form goes to the background... I realize that coding an event on the Child form to handle this would not work because the child window loses control and the main form gains control.. I thought of coding a function as follows on the main form but it does not seem logical because i would have to add to it for everyform and do checking to make sure the child is actually open before trying to close it..
Private Sub Form1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.GotFocus
MailSettingsWindow.Close()
RentalSettingsWindow.Close()
[code]....
I did away with the above sub routine and used the below code as per the recomendation of using showdialog which works just as i was looking for.
Private Sub MailingAndEmailSettingsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MailingAndEmailSettingsToolStripMenuItem.Click
Dim MailConfig As New MailSettingsWindow()
MailSettingsWindow.Showdialog()
End Sub
View 1 Replies
Oct 26, 2011
Using vb.net. I've got a main form that displays when application is opened. A popup form can then be opened. If there are other windows opened on the desktop, for example windows explorer, then when the popup form is closed, the main form gets hidden behind windows explorer. You have to move windows explorer out of the way to get to the main form. Is there a way to keep this from happening?
View 2 Replies
Jun 4, 2009
I have written a windows service that is meant to launch a notepad when a specific action happens. The problem i have is that even though the service launches notepad, the actual notepad it self is NOT visible. I know that it has been launced because i can see the process in the task manager. By the way the process is listed as a SYSTEM process rather than a process under my user name (i believe that is because my process is a "LocalSystem" one).
View 4 Replies
Feb 19, 2010
I have a project (Written in Visual Basic, using Visual Studio 2005) which has several user controls. I have had no problem setting it up where you click a button and it load a user control, but I cannot get it to remove the control that is currently open. For example The program opens on a starts screen, which has the choices, Control1, Control2, and exit. When you click Control1 button it should open up a screen to display an inventory. It does this just fine, but it does not close the main menu screen.
Here is the code for the initial startup of the project:
Public Class Form4
Public Sub Form4Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim CtrlMain As New ControlMain()
With CtrlMain
.Location = New Point(0, 0
[Code] .....
View 7 Replies
Apr 27, 2011
I have the following code to close a form which is a child. The problem is that when it closes, it closes the MDI parent too.
Private Sub frmTransaction_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
If ListView1.Items.Count >= 1 Then
[Code]....
View 4 Replies
Nov 30, 2007
I have a MDI form that has a child form that is opened by default when the application loads. I also automatically maximize the child form. Even though I have set ShowIcon to false, the little blank image that indicates that there is no icon appears in the upper left hand corner of the form. Is there a way to get rid of this?
Private WithEvents m_frmLineItems As frmLineItems
m_frmLineItems = New frmLineItems(Me)
mfrmLineItems.WindowState = FormWindowState.Maximized
[code].....
View 3 Replies
Nov 26, 2010
I'm trying to consolidate my application's dependencies. In this case, I have a console application (MAD - MPEG Audio Decoder) that I want to embed into my application. I've added it as a resource, but how can I reference it as a file? [code]...
View 2 Replies