Oop - Particular Object May Be Instantiated Only Once During Program Execution?
Dec 27, 2009VB.NET: What is the best way to ensure that a particular object may be instantiated only once during program execution?
View 3 RepliesVB.NET: What is the best way to ensure that a particular object may be instantiated only once during program execution?
View 3 Repliesproblem with no event fired after the wrapped ocx object with aximp sent out the message in a console application testing.
View 3 RepliesThis runs correctly, but Excel remains active after close.
If I don't create the range objects below, everything seems to work (with no output of course). Does anyone have any idea on how to keep Excel from staying in memory. Also... in the tests I'm running, I do not make the application visible.[code]...
I like to clarify the doubt regarding vb.net programming. my question is as follows.1. While executing the vb.net program, whether it takes RAM space or Hard disk space.
View 4 RepliesI'm attempting to display records on the screen 30 records at a time. When totrec is greater than 31, I was hoping the program execution would stop at the line "btn30to60.Focus()".Instead, execution continues and the sub "between31and60" is executed.If anyone has a simple way to halt program execution until the user clicks on the button "btn30to60"
Code follows:
If totRec > 30
And totRec < 61 Then
Call lessthan31()
[code]....
Error 1 Problem generating manifest. Insufficient memory to continue the execution of the program. Facsimile_XP
View 4 RepliesMy Application (Vb.net, Access 2003/2007) is to scan Access Database files for activex controls and to generate report accordingly.Problem:
Getting an error like:"Insufficient memory to continue the execution of the program."
The above error occurs while scanning for older version of Access files like prior to office 2000.
And the line of code where I get this is as follows:
Dim oForm As Access.Form Dim oAccess as Access.Application oForm = oAccess.Forms(objForms.Name)
But it opens the file and form as well.
Whether it is possible to read the file (Access Forms and Reports) or not?
Is there a command that will stop the execution of my program?
I have a service that is processes an exchange account via telnet every 10 minutes. During one point of execution the application could possibly have a response from the telnet session when there are NO e-mails in the folder, which would look something like this[code]...
So is it possible for me to just stop my application at that point since there's no point in continuing if there are no e-mails in the account?
I have written a converting program, which converts binary files to ASCII files. (VB.net 2010). I need to have a functional "stop" button on the form and I was wondering if there was a simple command to make a program stop, exit all procedures, and wait for user input on the form.
It is not feasible to multithread this application, as it frequently interfaces with the form. Currently, I have a global boolean variable which becomes true if the stop button is pressed, and I have internal loops checking to see if the variable is true. However, I don't to waste CPU on checking a variable if it's not necessary.
Question: I catch generally unhandled exceptions with AddHandler System.AppDomain.CurrentDomain.UnhandledException, AddressOf OnUnhandledException
The problem now is, with this exception handler
[Code]...
Question: I catch generally unhandled exceptions withAddHandler System.AppDomain.CurrentDomain.UnhandledException, AddressOf OnUnhandledExceptionThe problem now is, with this exception handler
Public Sub OnUnhandledException(ByVal sender As Object, ByVal e As UnhandledExceptionEventArgs)
Console.WriteLine(e.ExceptionObject.ToString())
[code].....
how to avoid this error?"Insufficient memory to continue the execution of the program "i always got this error when i trying to execute or run my program.. it come to the point that time error will appear.
View 2 RepliesI feel like the answers I seek are rather obvious so I feel silly for having to ask, but I just can't seem to figure this out (I'm new to threads, and am really only comfortable using them in Java at the moment). I have an Excel Addin application created with VB.NET, and I've noticed that occasionally while it's running some code (it's no one specific block of code) the program execution will just stop. This is especially problematic when I've set ScreenUpdating to False for Excel because the users then have to completely close out of Excel to get ScreenUpdating to true.
[Code]...
I only know how to add your program to windows task scheduler to schedule automatic execution but what if you wanted to have a particular thread run on a weekly schedule. Someone mentioned windows powershell for all these types of scripting; but it seems too hard to learn on short notice.
View 4 RepliesFor Each dgr1 In Me.DataGridView1.Rows
[Code]...
I m using access database and vb.net. My problem is that execution of program stops at third and sixth ExecuteNonQuery() methods because they are of string types and i am not able to understand the cause. I have also tried a single insert command but it gives syntax error so I used separate insert commands. The rest of the values are getting inserted properly.
My program keeps crashing every time I try to run it on another machine other than my own dev system. It runs just fine on mine but crashes on everybody else's when I install and run it. To make matters worse, it only gives me the generic "[name here] has encountered a problem and needs to close. We are sorry for the inconvenience". So i never can find out why and where it is crashing!!!!
[Code]...
I've written a keydown event that needs to occur multiple times during the execution of a program, and it needs to play a sound each time. The first time the keydown event is triggered, the sound plays without a hitch. However, the second time (and all subsequent times) the keydown event is triggered, a system beep accompanies the sound. I'm using Studio Express '10 and I've already integrated e.SuppressKeyPress into my code:
[Code]...
FIRST = arguments checked against each other
SECOND = arguments checked against each other but are irregardless of the FIRST arguments.
If (FIRST and (FIRST or (FIRST and FIRST))) OR (SECOND or (SECOND or SECOND or (SECOND and (SECOND or SECOND)))) then As the program processes this line over a million times during the execution, only FIRST or SECOND section is needed during an execution, never both. How do I make the program use only the section that's needed for the current execution instead of checking every argument every time? Is there a way to turn a string into an argument list for an IF...THEN statement? [code]
I�m having trouble with my VS. It gives me the error "insufficient memory to continue the execution of the program". This is a dangerous error because I cannot save the project either. So all work is for nothing. Actually VS destroyed my mainform at one time due to this error.
Now there shouldn�t be anything wrong with the computer or the project. The computer is new and with ok performance. The program runs ok on other computers (up to 5 yrs old) both published and in debug. On the old computer I use VS express, on the new I have Pro.
I think it has something to do with the graphics (I have added one or two pictures to the project since testing it on the older computer). VS graphics really doesn�t work like it should.
I have a mainform (the one that got destroyed) which I want to use as a MDI container. I want to have a picture as background. That doesn�t work (!) so I use a picturebox instead. When showing childforms the idea is that som part should be transparent, thus showing the MDI�s background.
In debug, as well as after publishing, the result is the MDI shows, and it actually has the picture as background. However the childforms don�t show at all. They show up in the window toolstrip though. Needless to say I cannot save the project because of the memory issue.
So, am I right in assuming that VS cannot handle a simple .bmp picture, or what should I do to be able to continue developing?
I am making a lunar lander game that randomizes the terrain for each new game, so each game is different. For my game, I am creating a graphics object that draws a closed curve for the terrain of the game. I am trying to then detect if a picture object collides with the graphics object.[code]...
View 1 RepliesI create an Instance of Access to view a report through my app.I would like to check if an Instance of Access has either already been opened by the user, or by the app. If so, use that instance.
Dim oAccess As Access.Application
Public Sub CreateAccessInstance()
Try[code]...
As it stands now, It creates multple MSACCESS.EXE processes which are running until I exit the app.
I think I just need a push in the right direction. I cannot seem to get my sub from an instance of my class, once instantiated, to run when I click on the button. My Code in the class is
When I click this:Private Sub btnBark_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBark.Click
mydawg.bark()
End Sub
[Code]...
When developing a Windows Forms Application, I can see in the Application.Designer.vb file where Me.MainForm = Form1, but I can't find where/how Form1 actually gets newed-up.
View 3 RepliesI am new to WPF and custom controls.I have implemented a custom control in VB with WPF and MVVM based on Davids example: [URL]..I have a custom control libary and a reference to my project to implement my control.I implement my contol in the View via XAML:
[Code]...
Is it possible to change the upperbound of an array once it has been instantiated? I want to change the upperbound in an array so it matches the number of items that hold a value.
View 11 RepliesI have a customer intranet (ASP.NET / VB) thats instantiating an asp.net session checking various things in the dblogin process. The Intranet has various sub-systems.The marketing sub-system requires an app_role to be assigned to the Intranet user for them to view the section.I need to create a new booking form for this section but the code appears to use a generic form which is use throughout the site in various other sections. So its not a good idea to ammend what is currently there.Create a new application in C# / ASP.NET and also in IIS. (rather than a new site, create an app within the Intranet site in IIS)Will I be able to check for the session thats currenting set in the cookie?If the session is open then the user is able to see the Intranet and I assume I will need to do some checks for the app_role too.I am simply going to put the URL for the app in the menu for marketing and then do another check just incase someone gives the URL to someone who doesnt have access to the menu.Will i be able to check and use the cookie thats been instantiated by another application?
View 1 RepliesCan you raise events from a class that has only shared members and doesn't get instantiated? I originally had the class members non-shared and created instances of the class where I need them. I had the events being raised and everything worked as expected. But as the class members are actually application level and do not need instancing, I converted all members in the class to shared so they could be accessed from anywhere in the program without creating an instance of the class. But WithEvents requires the creation of a class instance. I've done that and it seems to work fine when using an instance. And since I need the events handled in only one class, I can create the instance in that class and let all other areas access the class directly, without creating an instance.
View 10 RepliesI have a .Net 4 WinForms app that generates a DLL, calls CreateObject on the generated DLL then calls one of several methods that the DLL contains. The DLL is eventually used by a separate app. This WinForms app is just to generate and test the DLL hence why it can generate the DLL multiple times.The problem lies in the fact that calling CreateObject on the DLL locks the file to the process. The next time the DLL is generated it can't overwrite the previous DLL file on disk without closing the app completely and starting it again.
I've tried Marshal.ReleaseComObject, executing the CreateObject in a separate AppDomain, even setting the variable holding the COM object to a different COM object via CreateObject, manually calling GC.Collect() and a whole host of other things but none result in unlocking the file.The code flow is basically (simplified and generic names, etc.):
...
' Compile and generate DLL that is COM enabled and works fine
...
Dim foo As Object = CreateObject("Bar.Foo")
[code]....
is there a way to release a file lock on a COM DLL that has been instantiated via CreateObject without killing the process?
Note: this is a continuation of this original issue. I now have the DLL registering without locking the file but now the issue is with the CreateObject call not the DLL registration.
This is a question I have asked myself many times in the past as I nested using statements 5 deep. Reading the docs and finding no mention either way regarding other disposables instantiated within the block I decided it was a good Q for SO archives.
[Code]...
I have created a simple custom control - we will call it a "panel with buttons". Here is how I instantiate it:
[Code]....
So what I wind up with are multiple instances of my panel. Each of these panels has a button on it called Button1.
My question is - how do I capture this button event in a way that I will know which panel index it came from?
In the custom control there is only the Button1_click event - and when I click on it in any of the multiple panels I manually instantiated the event does occur, but how I can tell which one of my instantiated buttons were clicked...