This way I’m accessing as a list from my datagridview. The problem I’m facing here..Lets say if i have 6 rows in the DGV, when it updates to the list it shows 36rows.
How can i fix this problem??
for (int i = 0; i < testDsrcConfigs .Count; i++ )
{
Console.WriteLine(testDsrcConfigs [i]);
}
From the for loop, i can see 6 rows.
Is it possible to use for loop?? How can i adapt fro loop to access the members??Please help me..!
List<SdrcConfig> testDsrcConfigs = new List<SdrcConfig>();
foreach (GridViewRowInfo dr in RadGridView.Rows)
{
//Create a TrafficLane list
List<TrafficLane> covTrafLane = new List<TrafficLane>();
if (dr.Cells["bct0"].Value != "XXXX")
{
covTrafLane.Add(new TrafficLane(dr.Cells["bct0"].Value.ToString()));
}
if (dr.Cells["bct1"].Value != "XXXX")
{
covTrafLane.Add(new TrafficLane(dr.Cells["bct1"].Value.ToString()));
}
if (dr.Cells["bct2"].Value != "XXXX")
{
covTrafLane.Add(new TrafficLane(dr.Cells["bct2"].Value.ToString()));
}
if (dr.Cells["bct3"].Value != "XXXX")
{
covTrafLane.Add(new TrafficLane(dr.Cells["bct3"].Value.ToString()));
}
//Create RseDevicePosition
DevicePosition devPos;
int ctx;
Int32.TryParse(dr.Cells["bx"].Value.ToString(), out ctx);
int cty;
Int32.TryParse(dr.Cells["by"].Value.ToString(), out cty);
int ctz;
Int32.TryParse(dr.Cells["bz"].Value.ToString(), out ctz);
int bazu;
Int32.TryParse(dr.Cells["bazim"].Value.ToString(), out bazu);
int bele;
Int32.TryParse(dr.Cells["belev"].Value.ToString(), out bele);
int bti;
Int32.TryParse(dr.Cells["btilt"].Value.ToString(), out bti);
ushort devnum = UInt16.Parse(dr.Cells["bdevnum"].Value.ToString());
devPos = new DevicePosition(
new ValueWithUnit<int>(ctx, "mm"),
new ValueWithUnit<int>(cty, "mm"),
new ValueWithUnit<int>(ctz, "mm"),
new ValueWithUnit<int>(bazu, "tenthOfDegree"),
new ValueWithUnit<int>(bele, "tenthOfDegree"),
new ValueWithUnit<int>(bti, "tenthOfDegree"));
((MyConfig.
.ObuTransactionSystemConfig as DsrcTransactionSystemConfig).
DsrcSystemConfig as MultiLaneDsrcSystemConfig).DsrcConfigs.ForEach(
dsrcBeacon => testDsrcConfigs.Add(
new SdrcConfig(
dr.Cells["bid"].Value.ToString(),
dr.Cells["bdesc"].Value.ToString(),
covTrafLane,
devPos, devnum,
dsrcBeacon.Settings)));
}
Make the following change:
to