Question : C# int with variable as part of int name

Hi,
How can I take the following int and reference part of the name of the int in a variable loop?
Example:
int A10
int A11
int A12
int A13

Now inside of a loop:
I want to assign value to
int A+loop counter (ie 10,11,12,13 etc)
How do I assign value to A12 by
referencing int A and letting the 12 come from the loop counter.
Thanks
newbie

Answer : C# int with variable as part of int name

Looks like your syntax was just off a bit.  Try this code.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
On Error Resume Next
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set WshShell = WScript.CreateObject("WScript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")

'Variable Declarations
ProgramFiles = WshShell.ExpandEnvironmentStrings("%ProgramFiles%")
SystemDrive = WshShell.ExpandEnvironmentStrings("%SystemDrive%")
SystemRoot = WshShell.ExpandEnvironmentStrings("%SystemRoot%")
AllUsersProfile = WshShell.ExpandEnvironmentStrings("%ALLUSERSPROFILE%")
ScriptFullName = WScript.ScriptFullName
ScriptName = WScript.ScriptName
InstallDir = Left(ScriptFullName, Len(ScriptFullName)-Len(ScriptName)-1) & "\"
WshShell.CurrentDirectory = InstallDir 
ManagedMarker=InstallDir & "\Success.txt"
CfgXML="Configuration.xml"
CfgXMLbkp="configuration1.old"
CfgXMLPath="\Application Data\Cisco\Cisco Secure Services Client\system\"

'Create Logfile
Set InstLogFile = fso.CreateTextFile(ScriptFullName & ".Log",True)
InstLogFile.WriteLine Now() & " Starting Installation of """ & ScriptFullName & """."


If fso.fileexists(AllUsersProfile & CfgXMLPath & CfgXML) Then
	'archive file
	Set objFile = FSO.GetFile(AllUsersProfile & CfgXMLPath & CfgXML)

	If objFile.Attributes AND 1 Then
	    objFile.Attributes = objFile.Attributes - 1
	End If

	InstLogFile.WriteLine Now() & " Found 'Configuration.xml' in Allusers path.  Backing it up."
	fso.CopyFile AllUsersProfile & CfgXMLPath & CfgXML, AllUsersProfile & CfgXMLPath & CfgXMLbkp
	
	'copy new file
	InstLogFile.WriteLine Now() & " Replacing/Inserting new 'Configuration.xml'."
	fso.deletefile AllUsersProfile & CfgXMLPath & cfgXML
	fso.copyfile InstallDir & cfgxml, AllUsersProfile & CfgXMLPath & cfgXML

	If not objFile.Attributes AND 1 Then
	    objFile.Attributes = objFile.Attributes + 1
	End If
Else
	InstLogFile.WriteLine Now() & " 'Configuration.xml' not found.  Assuming CSSC not installed."

End If

InstLogFile.writeline now() & " Installation of """ & ScriptFullName & """ is Finished."
InstLogFile.Close()
Set InstLogFile = Nothing

Set FSO = Nothing
Set WshShell = Nothing
Random Solutions  
 
programming4us programming4us