Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 162
  • Last Modified:

Varibles made during runtime....

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
eversoslightly
Asked:
eversoslightly
1 Solution
 
MikeP090797Commented:
MsgBox "whatever" & cstr(abc) & "$"
0
 
mark2150Commented:
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
 
eversoslightlyAuthor Commented:
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
wj7sterCommented:
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
 
eversoslightlyAuthor Commented:
Ok... thank-you for the grim news :) hehe.
Thanks
0
 
eversoslightlyAuthor Commented:
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
 
wj7sterCommented:
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now