Solved

Varibles made during runtime....

Posted on 1998-09-14
7
151 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
Comment Utility
MsgBox "whatever" & cstr(abc) & "$"
0
 
LVL 12

Expert Comment

by:mark2150
Comment Utility
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
Comment Utility
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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 2

Accepted Solution

by:
wj7ster earned 10 total points
Comment Utility
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
Comment Utility
Ok... thank-you for the grim news :) hehe.
Thanks
0
 
LVL 1

Author Comment

by:eversoslightly
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
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…

771 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now