Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Varibles made during runtime....

Posted on 1998-09-14
7
Medium Priority
?
161 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
[X]
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
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 2

Accepted Solution

by:
wj7ster earned 40 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

715 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