Ensure Spawned Process Dies With An App?
Sep 5, 2008
how to ensure that a process created via the diagnostics.process class goes away when my app does. My app starts two processes, one runs plink and one runs psftp. Due to reasons that I don't want to become the focus of this post it is possible that my app will shutdown in an ungraceful manner. When this happens the psftp process dissapears but the plink process remains left behind. See the code below for how I am creating these processes.
Code:
Public Sub New()
Try
p = New Diagnostics.Process
'p.StartInfo.FileName() = "plink"
[code]....
View 2 Replies
ADVERTISEMENT
May 11, 2009
I'm using VB to create Excel templates and everything appeared to be working fine until I was stepping though some code today with my Task Manager open. I noticed that I had numerous instances of Excel open that should not be. This is the code that is being called to close the process:
[Code]...
When stepping through this code I am hitting the exception after the execution of the GC but the message box does not appear so the the using thinks that everything is fine. When I close my applicataion all of the Excel processes shown by the Task Manager close as well.
View 5 Replies
Nov 11, 2010
whenever i start my app and let it start a process, and the process dies or gets killed my app goes down too. but this only occurs when i'm debugging, not when i run the program
View 2 Replies
Jun 9, 2011
Is it possible to link a process (i.e. osk.exe) opened by a program so it dies when calling program dies?So, I start my application, it starts OSK.EXE, and if the program crashes, the on-screen keyboard is still there. Possible to link the two so that the process dies when the application dies?
View 10 Replies
Sep 7, 2011
I have an application that gathers information from a user into a Win.Form and then uses the Process.Start() to start Notepad and then using Sendkeys write the Notepad document.Sometimes this works great and sometimes the Notepad window is not started as the foreground process and the document is not written.What is the best way to ensure that the window opened by Process.Start("Notepad.exe") is the active window for the duration of the Process?
View 10 Replies
Jan 21, 2011
In VS 2008 Pro, my Find and Replace function just went belly up. I mean dead. I have a document open, I click Edit -> Quick Find or Quick Replace, and the Visual Studio window flashes (the control bar at the top goes gray as if the IDE was deselected) but the Find/Replace window never appears.
I've poked at my settings, disabled the addin I've been working on, and looked all over the various toolstrips in Visual Studio - no sign whatsoever of the Find/Replace Window.
View 6 Replies
Sep 2, 2010
My understanding is that thread.join will suspend the execution of code on the calling thread until the spawned thread finishes or is aborted...
With that in mind, I tried this:
For i = 1 to 50
threads = New Thread(AddressOf test)
threads.IsBackground = True
threads.SetApartmentState(ApartmentState.STA)
[CODE]...
However, the rest of the code runs when the loop finishes, not waiting for all the spawned threads to finish. Since the rest of the code needs the threads to finish (otherwise the rest will error).
View 4 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
Jun 11, 2011
Say if you had two private subs on a form, how do you ensure the first sub called has completed it task before the second is run.
[Code]...
View 4 Replies
Feb 20, 2010
I have a problem with ensuring no duplicates. I have an Appointments form (frmAppointments) and within it exits 4 date time pickers. The first 2 date time pickers are dedicated to creating an appointment date whilst the other 2 are for the purpose of changing an existing appointment date. When the date and time is entered into either one of the pairs (of date time pickers), the values inside get transferred to 2 corresponding textboxes. The user then clicks Save (btnSave) and the values are saved to sql.
How can I ensure no duplicates (of the date and time) can be created?
View 7 Replies
May 20, 2009
I am having a small 'head banging' experience working on one of our DLL products.The problem I am having is that this application is an outlook addin, and as such, does not own its own Message Pump. No problems there, I have a UI class, which starts a thread, and calls Application.Run(new fControlForm)
I use the Application.Run passing a form, rather than an ApplicationContext purely because I want this form to be in charge of displaying other forms: ie, I can use BeginInvoke to ensure that a second, and many more forms are created in the context of the thread that owns the Message Pump.
I however feel this to be quite hackish. I get a form displayed at startup (which I am sure I can hide if I needed to)My question: IS there any way to create some form of Invoke procedure in an applicationContext that uses the Message Pump thread? I have created a class which implements the ISynchronizeInvoke and can Invoke from a thread that it owns, however this is not the same as invoking from the Message Pump owner.
View 1 Replies
Jul 11, 2010
How can I ensure that a user enters data in one text box before being allowed to move on to the next text box Example I have four text boxes the user can enter a grade in. I want to lock the other three box until the user has entered a number in text box 1. Once a valid number has been entered in text box 1, that releases or enables text box 2. Once a valid number has been entered in text box 2, that releases or enables text box 3. And once a valid number is entered in text box 3, that releases or enables text box 4.
View 5 Replies
Feb 3, 2011
So when that code run the program don't switch.Say I want to
Open a file
Write something
Close a file
Way when I open a file, another thread want to open that same file. That means open a file get executed twice.
View 4 Replies
Sep 30, 2011
I have a screencasting program where it takes 10 screenshots every second and saves it to a temporary directory then through ffmpeg the series of images are compiled into a video format. My problem is that due to the computers processing power or the size of each screenshot and its quality it sometimes takes longer than 100 Milliseconds to create one causing the whole video to be off balance. How can I ensure 100% that 10 Images will be stored?
View 1 Replies
Sep 2, 2010
I've created some classes that will be used to provide data to stored procedures in my database. The varchar parameters in the stored procs have length specifications (e.g. varchar(6) and I'd like to validate the length of all string properties before passing them on to the stored procedures.
Is there a simple, declarative way to do this?
I have two conceptual ideas so far:
Attributes
public class MyDataClass
{
[MaxStringLength = 50]
[Code]....
This seems like a lot of work and will really make my currently-simple classes look pretty ugly, but I suppose it will get the job done. It will also take a lot of copying and pasting to get this right.
View 5 Replies
Feb 10, 2010
I have a WCF service being hosted in a Windows Service (using techniques discussed here) and it works great. I'm now writing a (VB.Net) frontend app that needs to call that service, but I don't want my users having to fiddle around with the services snap-in and starting the service manually. Can I write some code to ensure the Windows Service is started, or start it if it isn't?
Edit: OF course, I can ensure the Service startup is set to automatic, but it doesn't need to be running all the time, and even then the frontend app still needs to be sure the service is running and start it if it isn't.
View 2 Replies
Sep 8, 2009
I need to make sure that the connection to a POS printer is successful before writing data to the database and then printing a receipt. The POSprinter is normally of type BTP 2002NP but may differ. The common thing is that they are all connected via COM-port and NOT usb, so no drivers installed at all on the client. Can I send some kind of "ping" on a COM-port and check if a device is connected and turned on? Additional information, the application is developed in VB.net and Visual Studio 2008
View 2 Replies
Oct 6, 2011
Please take a look at the code below. I was told by the individual that developed itoriginally that the code only adds the rows of data the user entered. In other words,there 5 rows of textboxes. user can enter data into one row or into all 5 rows. If the user enters data into one row of textbox, that's what gets inserted into the db.I made some minor change to the code so that users can tell when a payment is made by check or cash payment.Since I made that change, whether a user enters data into one row or all 5 rows, all 5 rows get inserted into the db.How can I modify this code to ensure only rows entered get inserted?
For x = 1 To 5 Step 1
dedval = obr.FindControl("ded" & CStr(x))
chckvalflag = obr.FindControl("chck" & CStr(x))
[code].....
View 2 Replies
Mar 10, 2011
I have the following code which is part of a PA Call system: The 'SetPTT' nd 'DisableZones' statements set controls on the form where the code is. The LAPG2Coms.SetZones command starts another project within the solution to control an external controller. What I can't understand is why it executes the LAPG2 statement before SetPTT or DisableZones. The LAPG2 statement for messages is in the PlayMessage Procedure
[Code]...
View 12 Replies
Nov 25, 2011
I need to ensure that the user can only click the button (to acknowledge the message) and not do anything else (like clicking another button). How can I do that?
View 2 Replies
May 8, 2011
I'm trying to find out how to ensure a font is found by a project.I would expect to be able to add it (Them) to the recourses but can't find how to do that.When I get to 'Add item' I've tried 'New' and 'Existing' but can't find a template for fonts, so I'm lost (again).
View 3 Replies
Mar 6, 2012
I have a listbox that is sorted and the data table that is bound to it is also sorted. I am trying to add a Record to this data table and ensure that it is always at the end of the list. Is there a way to do this using specific character combination?
View 2 Replies
May 7, 2009
I need to ensure 2 calls are enlisted in a transaction
[Code]...
View 1 Replies
Sep 24, 2009
I've written a small program that monitors the customer field in Quickbooks and query's a database to determine if there are any important notes for the selected customer. This works fine however, I either need the messagebox or a form to come to the front of all open windows on the system to inform the user that the selected customer needs to be reviewed.
How can I ensure that a form (or messages box) that opens in my program comes to the front of any and all application windows that are open?
View 4 Replies
May 6, 2012
How can I ensure my app fully compatible with x64 Win7 platform? I have a choice of 32 or 64 bit development machines to use.
View 10 Replies
Mar 7, 2011
I have an application that opens a Excel file into a form using AxWebBrowser.Navigate. This works fine unless there is another Excel file open before I run the application, in which both excel files are opened in the same Excel application which then causes problems.
How can I ensure the AxWebBrowser.Navigate opens a New Excel application?
Imports Microsoft.Office.Interop.Excel
Imports Microsoft.Office.Interop.Owc11
Imports System.Runtime.InteropServices
[Code]....
View 1 Replies
Oct 17, 2010
How can we ensure that an NUD has a value DISPLAYED if the user deletes its contents?
View 5 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 17, 2010
I have a form (formA) which contains a tabcontrol with two tab pages. Each tabpage has 6 textboxes and 3 comboboxes. In addition to the tabcontrol there is a separate combobox and textbox. The question I have, is how to best ensure that all these fields are populated with text and or numbers? From this a start button is pressed which generates another form (formB) which requires the fields from (formA). If for instance 1 or more fields is not populated, then generate a message to show the user which 'box' requires data. Only when all fields are populated will this enable the 'start' button.
View 5 Replies
Jan 4, 2011
I have a form with a drop down combo box and a list view. The user selects a date from the combo box and then they are to select an item from the list view. I want to ensure that the user has selected a date from the combo box before processing the information from the selection in the list view.
If cboYEARMONTH.SelectedItem = Nothing Then MessageBox.Show("Please Select a Year Month")
View 1 Replies