Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / General 2 / October 2003



Tip: Looking for answers? Try searching our database.

Form level array

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Spider - 26 Oct 2003 17:09 GMT
How can i reset a form level array when user clicks on a "Reset" command
button? I need to clear the array contents to begin again.

Can an array inside a class module be reset from a form?

I've tried all I can come up with to do both. Any suggestions?
Don@home.com - 26 Oct 2003 17:19 GMT
>How can i reset a form level array when user clicks on a "Reset" command
>button? I need to clear the array contents to begin again.
>
>Can an array inside a class module be reset from a form?
>
>I've tried all I can come up with to do both. Any suggestions?

ReDim YourArray(0)
OR
ReDim YourArray(WhatEverYouNeedGoesHere)

Have a good day...

Don
Spider - 26 Oct 2003 17:24 GMT
i've tried the redim arr(0), redim arr(), and other combinations with no
effect.

a little more detail...

the command button is form level
the array is form level
the array is called in a form level sub

so.. it would seem the array could be seen by the redim statement, but it
doesn't seem to work.

:-(
>
[quoted text clipped - 12 lines]
>
> Don
Don@home.com - 26 Oct 2003 17:43 GMT
I was assuming that your Array() was dynamic...
Is this the case???
Or is it Fixed, ie: Dim YourArray(10) as String
If it is the last case then you have to loop through the array to re-initialize
it..
For x = 0 to 10
   YourArray(x) = ""
Next x

>i've tried the redim arr(0), redim arr(), and other combinations with no
>effect.
[quoted text clipped - 24 lines]
>>
>> Don

Have a good day...

Don
Martin Trump - 26 Oct 2003 17:48 GMT
>i've tried the redim arr(0), redim arr(), and other combinations with no
>effect.

Did you *start* with:-

Dim arr()

i.e. make it a dynamic array?

Regards

Signature

Martin Trump

Spider - 26 Oct 2003 17:51 GMT
Yes, the array is dynamic. As follows...

Private r_arr() As Single

> >i've tried the redim arr(0), redim arr(), and other combinations with no
> >effect.
[quoted text clipped - 6 lines]
>
> Regards
Spider - 26 Oct 2003 17:57 GMT
The code holding the array...

Public Sub ResistArr(val As Single, _
                    arr() As Single)
   'in: val    value to be summed
   'out: arr   array cell values

   Static i As Integer    'preserve array index between clicks

   ReDim Preserve arr(i)     'redim array
   arr(i) = val

   For i = LBound(arr) To UBound(arr)
       frmDC.picResist.Print ; Tab(4); "R" & (i + 1) & _
                               "  " & arr(i)
   Next
End Sub

> >i've tried the redim arr(0), redim arr(), and other combinations with no
> >effect.
[quoted text clipped - 6 lines]
>
> Regards
Don@home.com - 26 Oct 2003 18:01 GMT
Your are NOT resetting the Static 'i' any where that I can see so it will always
ReDim it to what ever the last pass set it to...

>The code holding the array...
>
[quoted text clipped - 24 lines]
>>
>> Regards

Have a good day...

Don
Spider - 26 Oct 2003 18:24 GMT
That did it Don...Thanks.

:-)
> Your are NOT resetting the Static 'i' any where that I can see so it will always
[quoted text clipped - 32 lines]
>
> Don
Richard Iain Blakeway - 31 Oct 2003 04:21 GMT
erase array_name

> How can i reset a form level array when user clicks on a "Reset" command
> button? I need to clear the array contents to begin again.
>
> Can an array inside a class module be reset from a form?
>
> I've tried all I can come up with to do both. Any suggestions?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.