Hi,
I want to create an unknown number of variables, depending of the value of
another variable (amounvar)..
The created variables must have the name: var1, var2 etc ... I never know in
advance 'amountvar'.
I tried this but doesn't work:
.....
amountvar=30
for i=1 to amountvar
dim var & i
next
Thanks for help
Britt 5 825
Britt,
This is what arrays are for.
Kerry Moorman
"Britt" wrote:
Hi,
I want to create an unknown number of variables, depending of the value of
another variable (amounvar)..
The created variables must have the name: var1, var2 etc ... I never know in
advance 'amountvar'.
I tried this but doesn't work:
.....
amountvar=30
for i=1 to amountvar
dim var & i
next
Thanks for help
Britt
try using arrays or an arraylist. in an array, you specify the size (which
can be expanded during execution)...for example
Dim arrInt(5) as Integer
that creates 6 integer variables, arrInt(0), arrInt(1), ..., arrInt(5). to
use those variables, you just say exactly what i did above, arrInt(index
number).
you could also use an array list object
Dim arrInt as New ArrayList
arrInt.Add(some object or value here)
var = arrInt(index)
and since they are collections, you can use them in for loops
hope this helps
--
-iwdu15
It sounds like an array.
amountVar = 30
Dim myVariables(amountVar)
Now you have access to 31 variables, numbered from myVariables(0) to myVariables(30).
-----
Tim Patrick
Start-to-Finish Visual Basic 2005
Hi,
I want to create an unknown number of variables, depending of the
value of
another variable (amounvar)..
The created variables must have the name: var1, var2 etc ... I never
know in
advance 'amountvar'.
I tried this but doesn't work:
....
amountvar=30
for i=1 to amountvar
dim var & i
next
Thanks for help
Britt
You can't. Use an array or a generic list.
Robin S.
"Britt" <fb****@dvsv.qswrote in message
news:%2********************@TK2MSFTNGP04.phx.gbl.. .
Hi,
I want to create an unknown number of variables, depending of the value of
another variable (amounvar)..
The created variables must have the name: var1, var2 etc ... I never know
in advance 'amountvar'.
I tried this but doesn't work:
....
amountvar=30
for i=1 to amountvar
dim var & i
next
Thanks for help
Britt
Thanks all
"RobinS" <Ro****@NoSpam.yah.noneschreef in bericht
news:yJ******************************@comcast.com. ..
You can't. Use an array or a generic list.
Robin S.
"Britt" <fb****@dvsv.qswrote in message
news:%2********************@TK2MSFTNGP04.phx.gbl.. .
>Hi,
I want to create an unknown number of variables, depending of the value of another variable (amounvar).. The created variables must have the name: var1, var2 etc ... I never know in advance 'amountvar'.
I tried this but doesn't work: .... amountvar=30 for i=1 to amountvar dim var & i next
Thanks for help Britt
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Tuhin Kumar |
last post by:
Hi,
Oracle give the error ORA-01418 when I try to do the
following;
Create unique index t1_pk on TABLE1(EntryId DESC) ;
If the I try to add primary key Contraint using the above index t1_pk...
|
by: dog |
last post by:
I've seen plenty of articles on this topic but none of them have been
able to solve my problem.
I am working with an Access 97 database on an NT4.0 machine, which has
many Access reports.
I...
|
by: Marc Miller |
last post by:
Hi all,
I have 2 dev. machines, the 1st is Win 2000 with .NET 7.0 and the 2nd is XP
Pro with .NET 2003. My Web Server is Win 2000 Server with IIS 5.0.
I can create a new project on my test...
|
by: Lyle Fairfield |
last post by:
MSDN Home > MSDN Library > Win32 and COM Development
Data Access
Microsoft offers many data access technologies to suit various
development needs. This section of the MSDN Library contains...
|
by: sandy |
last post by:
I need (okay, I want) to make a dynamic array of my class 'Directory',
within my class Directory (Can you already smell disaster?)
Each Directory can have subdirectories so I thought to put these...
|
by: etuncer |
last post by:
Hello All,
I have Access 2003, and am trying to build a database for my small
company. I want to be able to create a word document based on the data
entered through a form. the real question is...
|
by: shira |
last post by:
I have done a fair bit of searching, but haven't yet been able to find
an explanation as to why one would set "ignore nulls" to "yes" when
creating an index. I understand what it does (I think),...
|
by: MaryamSh |
last post by:
Hi,
I am creating a Dynamic Search in my application.
I create a user control and in Page_load event I create a dynamic dropdownlist and 2 dynamic button (Add,Remove)
By pressing Add button...
|
by: MaryamSh |
last post by:
Create Dynamic Dropdownlist Controls and related event
--------------------------------------------------------------------------------
Hi,
I am creating a Dynamic Search in my application.
I...
|
by: Alvin SIU |
last post by:
Hi all,
I have a table in Db2 v8 like this:
Team Name Role
------ -------- ---------------------
A Superman Leader
A Batman Member
A WonderWoman Member
B ...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |