Computing.Net > Forums > Programming > vb size array

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

vb size array

Reply to Message Icon

Name: Joann
Date: December 7, 2003 at 19:35:11 Pacific
OS: xp
CPU/Ram: 128
Comment:

Hi,

Just wanted to know how you create a variable array using a textbox. More
specifically typing the max size of the
array in the text box. I have already tried
dim x(1 to textbox.text) as integer
dim x(1 to ()) as integer

But these just come up with an error saying
it must be consistent.



Sponsored Link
Ads by Google

Response Number 1
Name: Click_er
Date: December 7, 2003 at 22:56:25 Pacific
Reply:

i'm not sure..i've not programmed in VB in quite some time
you need to declare the array first
try to do something like this
dim my_array(0 to 1) as integer
now somewhere in your program

dim number as integer
number = textbox.text
redim my_array(0 to number)

try this..hope it helps



0

Response Number 2
Name: Dipankar Basu
Date: December 8, 2003 at 03:25:16 Pacific
Reply:

Please declare the array
Dim x() as integer
Later use a variable ub=Text1.text on ur code
Next, use the command ReDim x(ub) and I hope it will solve ur case.
You may use the Option Base 1 in the General Declaration section to specify the lowerbound of the array to 1, it is not recommended because VB.NET allways use lowerbound of an array as 0. Hope this proves useful


0

Response Number 3
Name: wsd
Date: January 9, 2004 at 01:09:09 Pacific
Reply:

Hi,
Try this:
dim x() as string
dim TextLength as long
TextLength=Len(text1.text)
Redim Preserve x(TextLength) as string
(or)
if you want an empty array declare
Redim x(TextLength) as string


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: vb size array

vb control array www.computing.net/answers/programming/vb-control-array/8634.html

C++ large array size www.computing.net/answers/programming/c-large-array-size/7963.html

VB Formatting Arrays for .dat file www.computing.net/answers/programming/vb-formatting-arrays-for-dat-file/15952.html