End / Quickly Terminate The Program ?
Oct 12, 2011In certain error situations within my VB 2008 code, I need to quickly terminate the program. This should be simple, but I haven't been able to figure out how to do it.
View 5 RepliesIn certain error situations within my VB 2008 code, I need to quickly terminate the program. This should be simple, but I haven't been able to figure out how to do it.
View 5 RepliesI have a simple GUI form to hide / show / minimize / terminate / force terminate Processes. i can do all well but for show and hide i need the MainWindowHandle to show or hide it
So here is hide process code:
Dim Proc As New Process = Process.GetProcessesById(List.SelectedRows(0).Cells(1))
Dim hwnd = Proc.MainWindowHandle
ShowWindow(hwnd,0)
If i try the same with show code:
Dim Proc As New Process = Process.GetProcessesById(List.SelectedRows(0).Cells(1))
Dim hwnd = Proc.MainWindowHandle
ShowWindow(hwnd,9)
The MainWindowHandle become 0 cuz its hidden is there is any other way to get the MainWindowHandle of Process ?
when i run any of my program this error is show to me i don't know why, "it said that the program will terminate OK".
View 13 RepliesI've started a process through system.diagnostics .process.start("C:/process.exe")Now my question is, how can I terminate the same process in vb.net
View 4 RepliesI'm trying to close down a program from within the constructor for the main form. I've tried Me.Close() but this gives an error: ObjectDisposedException was unhandled. Here's the details:
System.ObjectDisposedException was unhandled
Message=Cannot access a disposed object.
Object name: 'Form1'.
[Code].....
I am trying to end a program immediately when a critical exception is caught. But I am finding that code after my Try/Catch block is executing even though the code withing the Catch block is executing, and that Catch code is calling Me.Close.
I suspect it has something to do with background .net threads or something, but I have no clue how to deal with those kinds of issues. How can I stop the program as quickly as possible? If code after my Catch executes, it will (and does) throw lots of uncaught exceptions later. Currently, it is not feasible for me to try to catch all the other exceptions. I just want to report an error and end the program.In my form load routine, I create and set up a number of objects and arrays by calling various subroutines.The success of most of the subroutines depends on the sucess of three subs in particular, which are called early on. If one of those three fails, there will undoubtedly be a number of hard to trap exceptions later on in the load routine.
[Code]...
I have just started a simple project in VB 2008 express (having previous experience (not much though) in VB6). At the moment I have only 1 form and when I click on the red x close button the form closes but the process is still running in task manager. I have the following code which I assumed would exit the program and terminate the process but it doesnt seem to work[code]...
View 6 RepliesHow to terminate function/code (not entire page) when it takes some time, for example, more than 1 sec?[code]...
I found the command "Server.ScriptTimeou", but it stops the entire page instead of one command.
I have just built a full main menu for my pc game and need to terminate the running program using a button held within the form. I have built a button labeled exit and tried a couple of closing codes such as:
Me.Close
ExitApplication
Is it possible to terminate a program from another program, Or maybe exchance a handler so it can close down itself when neccesary?
View 2 Repliesi turn on my computer and appear this " Ixdn MsdMon.exe-fatal error CLR error: 80004005 the program will now terminate" and the computer runs very slow
View 1 RepliesI'm developing a program using VB 2005.I've tried to use the following instructions to "kill" the application
Application.Exit()
Environment.Exit(0)
(not at the same time)
[code]....
I want to develop an application using VB.Net to detect the arrival of USB Key once it's plugged into the USB port. I used a method by getting the list of all drives in the computer and then I check whether the type of the drive is "Removable Disk" and "Is ready" or not!. By using this method, I can figure out which drive is Removable drive. BUT I get confused with the FLOPPY Drive because it's also a type of Removable drive.
View 1 RepliesI found information about how to fade images on the net. But it is extremely slow. Here is the code:A is an ImageAttributes variable. matrixEl is the float value that is incremented to fade in the image.
View 6 RepliesI'm working on a program that has to continue functioning even if the SQL database isn't available. If the user has sufficient rights they can continue on using manually entered values.
The way I'm doing this it takes a very long time to fail before this can happen. Is there a way to quickly, or continually, determine if the SQL database is available so that I can avoid trying the stored procedure if it isn't?
Dim tblSteps As DataTable = New DataTable
Dim StepsBindingSource As New BindingSource
Private Sub cmdExecuteSproc(ByVal SO_Number As String, ByVal Prev_SO_Number As String)
[Code].....
I am currently writing a program and I have all the windows in three languages. Is there any way of quickly changing through the languages? I mean, I can do it manually but the list has like 500+ languages and I was wondering if there was any keyboard shortcut to switch between the used languages, or any way to put a buttom on the toolbar.
View 4 RepliesI using Microsoft.Office.Interop.Excel I get returned a 2D array of type object[,] which contains double for elements. Note that the index lower bound is 1 instead of the default 0, but I can deal with that easily. How can nicely convert the array into double[,] using .NET 3.5. (by nicely I mean concise, or compact).
[Code]...
I am working on a application that stores videos, images and files. I would like to give the user the possibility to encrypt them. I am tying to use AES to encrypt them but the problem is that the decryption takes to long.I was hoping that the loading time from the hard disk of the encrypted file was far longer than the process of decryption of an image for example but i was wrong
So if i try to 1) load the image 2)decrypt it and 3)load it in a image control it takes 15 times more time that loading the original file not encrypted
I saw the video from microsoft teaching the techique of programming and found out they can comment multiple line and the same time.
View 2 RepliesI want to create my special full-text index using text files, without database.I saved records ids for every word in index, in text file..Now if I want to search for tow words together; I have to get ids that is shared between these words by comparing text files of these words ids; and saving the result in other text file.[code]But now the problem if the first word has 100,000 ids and also the second word same it; the loop will take too long time! It will loop 100,000 * 100,000 times!How can I find another way to compare these files quickly; or another idea for my full-text index with text files?
View 4 RepliesI am trying to read this XML document.
An excerpt:
<datafile xmlns:xs="[URL]" xmlns:xsi="[URL]" xsi:noNamespaceSchemaLocation="wiitdb.xsd">
<WiiTDB version="20100217113738" games="2368"/>
<game name=" Wanted: 50 Wacky Jobs (DEMO) (USA) (EN)">
<id>DHKE18</id><type/>
<region>NTSC-U</region>
[Code] .....
It just skips the "While iter.MoveNext" part of the code. I tries it with a simple XML file, and it works fine.
When I use the Debugger to to debug some code, I see a subrountine (or function) call.
How do I quickly locate the code for that subrountine (or function)?
Im have a form and an image. Imagine the form's backcolor to be black and the image to be a landscape. When you resize the form the image is also resized and streched towars all directions. The point is that as you resize the form the image delays to be resized so the background which is black is showed.
View 1 RepliesI am writing an import program to import data from an access database to a SQL database.The table structure in the SQL and Access are the exact same with the same field names.I was wondering if there was a quick way to get the data into the SQL table without have to loop through each record?Currently:1. User selects the file2. Use a oledb connection i load the data into a DataAdapter3. Datadapter is bound to the DatagridNormally i would loop through each record in the datagrid and insert it into the table but i was wondering seeing as the column names are the same if i could save the messing about with loops and insert statements using 30 column names.
Code to load the Data is below
ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & database & ";Jet OLEDB:Database Password=bekdemir"
[code]......
I'm pulling from a text box for recording scores like 2, 47080, 88 and for better aesthetic look on viewing results i wanted to format results like so:
00002
47080
00088
Only way i could format was to convert to number and use: Score.ToString("0000#") not worried about validation, this is just something for my rug rats.Is there a better way, as in not having to convert to number first?
How can I perform a very fast search in an array, that finds a substring of an entry in the array? As an example, let's say that I have an array containing these objects (as strings):
[Code]...
What I then want to do, is to find any matches matching (as an example) the letter "S". I want it to display all the entries with the letter "S" in it. I don't want to use loops of any kind, and I prefer using things such as the array's inbuilt BinarySearch function. However, it seems like the BinarySearch function only compares from the beginning of each item. I'm using very large arrays. So a fast method is really needed.
I need a way to add hundreds of thousands, millions, and possibly a billion items (Really anything in the range of Int32) to a DataGridView Control quickly, I was hoping for something under a minute. I have been trying various ways, the fastest way so far I have found is to add cells to a DataGridViewRow and then add the row to the DataGridView Control. As of now, I am using a BackgroundWorker as a second thread so I show progress of the operation.
View 5 RepliesI have a folder that can (hundreds currently) but upwards of 10's of thousands of files. I have a program that gets all file names, and sorts them based upon set criteria and displays them in a treeview. My issue is right now a few hundred files moves fairly quickly when getting files name (path.getfiles), sorting, and returning sorted list for further search and display. My concern is when the number of files starts to increase, alot of these functions will take exponentially longer to perform. Especially my organizing function.
Because my files are part numbers <PartNum><Rev><SubRev><ManuNum>.<extension> I first sort out all different Part numbers first making the list manageable (maximum of a few thousand). Then as you choose a part number to work with, it retrieves all files associated with that part number (maximum of a few hundred).
My concern is everytime I need to look for a file in anyone of those steps, I have to import all file names, search and return correct file path, and Im sure this will become slow as the number of files increase. I dont mind having it do it once then update the list as needed. So I was thinking import and sort all file names at load, and check every so often for and files that might have been modified recently and just update it's entry in the sorted list. But this means my program has to stop, and check all files for changed "modified" time, which too will be slow-ish.
In developing a flash-based memory manager, I need to be able to view large quantities of data. With my eyes and monitor resolution, I can read hand-drawn 3x5 letters on a 4x6 matrix without too much difficulty, but none of the system TrueType fonts render optimally at that size. I've tried writing code to draw font shapes to off-screen bitmaps, and then use DrawImage to copy those bitmaps to the screen, but I can't get good performance. This is for development, not production, so performance doesn't have to be absolutely optimal, but I don't want to spend too long waiting for screens of data to refresh.
What would be the best way of either making .net display a font which is pixel-perfect what I want, or else building a bitmap out of lots of little pieces quickly? I'm using vb.net, so I can't simply generate a bitmap as a byte array and pass that to the Bitmap constructor unless someone can show me how to convert an array into an IntPtr.
I'm just having a small problem with tabpages. I have a program that have multiple forms (on startup they are all created and hidden, except for the one being viewed by the user). When the user open one particular form, I has a tab control with two pages. I also have a toolbar. when the user click a menu option, I call a method that assigns all my controls to a variable (to be used in an insert statement later).
Here's an example of that Sub:
Public Sub SetValues()
'page 1
DateCreated = Date.Now
DateEdited = Date.Now
DateCompleted = Me.DateTimePicker2.Text
[Code] .....
The problem is, the controls on the second page cant be "seen" (this is confirmed by placing a msgbox in the above sub, which comes up blank) until the user open the second tab, at least just once. Then its ok. I know I can just run a small method to quickly open all tabs, but is there a reason this is happening, and a better way to do this?