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
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.
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
Summary: Hi, How do I make vb add the total of certain fields from a Microsoft Database? For example if the first field was "quantity" and the second field was "price", using a control array it would be label...
Summary: Thank you very much! I can get a very size array through global definition now. I have another question now. The size of my array is determined through a preceeding calculation. But the size of array ...
Summary: Okay I solved the first part to my problem and now I have run into another situation. I have been trying to resolve this for almost a week and cannot come up with or find anything that works. I am ...