473,407 Members | 2,629 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

How do I reset a program to its initial state

My program has several global arrays declared but not sized: Public Shared A
As Double(,), Public Shared B As Double(,), etc.

As methods are called the arrays are sized as appropriate for specific
circumstances. As time goes by, memory gets used and things sometimes bog
down. I would like to be able to reset my program to its initial state with
some kind of "clear" subroutine.

I have tried something like this:
Dim blank(1, 1) As Double
A = (blank)
B = (blank)
C = (blank)

And it helps but doesn't really do enough sometimes and I have to quit and
start-up again.

Is there a way to reinitialize everything without closing the application
and starting up again?
--
mark b
Dec 6 '05 #1
3 3497
Mark,

Visual Basic's Erase command will clear arrays and free their memory.

I think you can also assign a value of Nothing to the array to accomplish
the same thing.

Kerry Moorman
"mark" wrote:
My program has several global arrays declared but not sized: Public Shared A
As Double(,), Public Shared B As Double(,), etc.

As methods are called the arrays are sized as appropriate for specific
circumstances. As time goes by, memory gets used and things sometimes bog
down. I would like to be able to reset my program to its initial state with
some kind of "clear" subroutine.

I have tried something like this:
Dim blank(1, 1) As Double
A = (blank)
B = (blank)
C = (blank)

And it helps but doesn't really do enough sometimes and I have to quit and
start-up again.

Is there a way to reinitialize everything without closing the application
and starting up again?
--
mark b

Dec 6 '05 #2
"mark" <ma**@discussions.microsoft.com> schrieb:
My program has several global arrays declared but not sized: Public Shared
A
As Double(,), Public Shared B As Double(,), etc.

As methods are called the arrays are sized as appropriate for specific
circumstances. As time goes by, memory gets used and things sometimes bog
down. I would like to be able to reset my program to its initial state
with
some kind of "clear" subroutine.


Assign 'Nothing' to the array variable. I suggest to take a look at the
'Erase' statement too.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Dec 6 '05 #3
Mark,

If it is a form or a component, than you can probably achieve what you want
by looking how to reuse the
InitializeComponent()

in the designer part

You have to remove of course than first every control from the form.

http://msdn.microsoft.com/library/de...cleartopic.asp

Me.controlcollection.clear

I never did it however when I once told this to somebody else he wrote back
that it was working very well for him.

I hope this helps,

Cor


"mark" <ma**@discussions.microsoft.com> schreef in bericht
news:F0**********************************@microsof t.com...
My program has several global arrays declared but not sized: Public Shared
A
As Double(,), Public Shared B As Double(,), etc.

As methods are called the arrays are sized as appropriate for specific
circumstances. As time goes by, memory gets used and things sometimes bog
down. I would like to be able to reset my program to its initial state
with
some kind of "clear" subroutine.

I have tried something like this:
Dim blank(1, 1) As Double
A = (blank)
B = (blank)
C = (blank)

And it helps but doesn't really do enough sometimes and I have to quit and
start-up again.

Is there a way to reinitialize everything without closing the application
and starting up again?
--
mark b

Dec 7 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Ken | last post by:
How can I reset the initial form variables that are set with session statements when clicking on a button? I tried this but the function was not called: <?PHP function reset_form($none) {...
8
by: Ryan Stewart | last post by:
Is there a way to reset the style property of an HTML element to some default or to all empty values? I have a group of elements whose style settings may be changed arbitrarily at certain points in...
4
by: Lee Chapman | last post by:
Hi, Can anyone tell me why in the code below, the call to ClearChildViewState() has no effect? To paraphrase the code: I'm using view state. I have a textbox and a submit button (and a label...
4
by: toufik | last post by:
Hi, In the ValueChanged event of a dateTimePicker control I've a condition, and I like to reset the initial value if teh condition is false Private Sub dateDebut_ValueChanged(ByVal sender As...
5
by: cotton_gear | last post by:
Hello, When I clicked on the Reset button I need to reset only few fields selectively. How do i achieve it using javascrript ? Actually, when reset is clicked, even hidden fields are reset. I...
1
by: Willing 2 Learn | last post by:
Below is a program I did to recognize a Finite State Automata for ASCII (J+H)*. I got that one working but im having trouble getting the NFA program to work. I really desperately need help! My...
3
by: Art | last post by:
I have few buttons on my ASP.NET page which are supposed to hide and show pannels. On the initial load everything is properly populated but then when I press one of the buttons, which are supposed...
53
by: Sanders Kaufman | last post by:
I'm having a BLAST writing this app as OOP as PHP allows. It's one thing to discuss the dance, but it's a thing of beauty to see the performance. I'm noticing that the constructor is a "reset"...
11
by: newbie | last post by:
i have a form in which a hidden field (initial value as '0', and my javascript set it to '1' when an event is trigged). In the same form, i have a reset field. But I realized that the hidden field...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.