Moving an array element to a varaible.
When I started I didn't think just taking an element and copying to a varaible was such a hassle.
Ok, I have a string array defined as:
public
static string[] Trux_Info = new string[20];and I have a varaible define as
public
static string port_in = "";Now I thought that something like
port_in = Trux_Info[3]
would work. It didn't. I tried Trux_Info.GetValue(3). It didn't work right. I know Trux_Info has info I can print to screen\file and the right info is there. I even passed the array across child, parent and back to a different child, the info is there.
I really need this element to go to this single variable, because after this happens then the processing can begin.
Any and all suggestion are appreciated.
Thanks N.
Vimal KandasamyPosted May 15, 2009, 7:36 AM
What is the problem in that,where you got error.
Have you assigned values to array before use it?.
if you assigned something like
Trux_Info[3] = "hi"; before the statement
port_in = Trux_Info[3]; means then surely it will return value.
and below code also will return same value.
port_in = Trux_Info.GetValue(3).ToString();