Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Varables to build Names of form items

Status
Not open for further replies.

KeyserSoze1877

Programmer
Sep 6, 2001
95
US
I have a program that does this...

I have a form with 26 seperate control arrays of 3 items. Each array represents processes on a server. So 26 servers, I look at 3 specific process on each one and depending on rules I was going to have simple shapes (small circles) that I color green, yellow, or red depending on whats going on.

I loop through my server names, I ran into an issue where I depending on what server I am on I need to modify the specific array.

The name of my shapes are CA001shp, CA002shp and so on to CA026shp. CA001shp has (0), (1), (2) array elements for the 3 shapes as do the others the same way. So when I build the var name I have (0) always be one process, 1 being the other and so on...

If I am reading CAServer001 processes, programatically in a loop, how do I build the item name CA001shp to do a CA001shp.fillColor on it, no hard coding the shape names. Everything is ini file driven. I am building this for growth all I have to do it modify the ini file.

I also use Cold Fusion and they have an Evaluate function that allows me to user variables for item names etc...

How can I do this in VB?

---------------
Keyser Soze
"Vote Pedro.
 
I figured it out.
Quite simple actually from some of the responses I read for similar deals...

The Variable J is a 0 to 2 for loop for the array elements.

First I build the name and store it in a string:
NameHold = "CA" & Servernum & "Shp"

Then do this command, and BINGO! frmMain is the name of the form the array sits on:
frmMain.Controls(NameHold)(J).FillColor = &H0&


Thats it!
You can do all the properties on the array. It works.

I'd like to thank myself.


---------------
Keyser Soze
"Vote Pedro.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top