Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Varibles made during runtime....

Posted on 1998-09-14
7
155 Views
Last Modified: 2010-04-30
Here's what I want to do...

( No Option Explicit )
dim abc as integer
abc = 23
whatever(abc)$ = "Testing..."
msgbox whatever(abc)$ = "testing..."

Now... I'm hoping that whatever(abc)$ really is whatever23$
How can I do this?  Thanks.


0
Comment
Question by:eversoslightly
7 Comments
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1434831
MsgBox "whatever" & cstr(abc) & "$"
0
 
LVL 12

Expert Comment

by:mark2150
ID: 1434832
This is from the VISBAS-L Digest - 11 Sep 1998 - Special issue (#1998-1188)

'Form1 Code:
Private Sub Form_Load()
    Text1.Text = "Form2"
End Sub

Private Sub Command1_Click()
    LoadFormByName Text1.Text
End Sub

Private Sub LoadFormByName(sFormName As String)
    Dim NewForm As Form
    Set NewForm = Forms.Add(sFormName)
    NewForm.Show
End Sub

0
 
LVL 1

Author Comment

by:eversoslightly
ID: 1434833
Sorry... thats not what I want....
what I'm looking for is....

that if
abc = 23
then when you do
whatever(abc) = "ya"

whatever23 = "ya"

But if abc = 13
then I want it to do:
whatever(abc) = "ya"
whatever13 = "ya"

I want it to make those varibles at runtime.

Hope this clarifies.
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 2

Accepted Solution

by:
wj7ster earned 10 total points
ID: 1434834
This is not possible in VB (or any other language that I know of.  What you have in you code sample is an array with the name 'whatever' and you have set the 23rd element in this array to 'testing'

The correct way to read this value is:
msgbox whatever(23)

0
 
LVL 1

Author Comment

by:eversoslightly
ID: 1434835
Ok... thank-you for the grim news :) hehe.
Thanks
0
 
LVL 1

Author Comment

by:eversoslightly
ID: 1434836
btw, that is possible in Perl (you said its not possible in any other language)  It's called an associative array.  It goes like:
$whatever{'23'} = "Hello!";
or
$whatever{'foo'} = "bar";
0
 
LVL 2

Expert Comment

by:wj7ster
ID: 1434837
Quite right, about what I said, and I don't know Perl, and that is probably why I didn't know that it could do it... Then again, here is exactly what I said: "...or any other language that I know of...".

Good luck.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question