I have saved the information in the dictionary. and the dictionary in updated by the user. how can i retrieve the information from the dictionary. I have done the some code. put i do not know how to get the information from dictionary.
Code
//Create the dictionariesCode
Dictionaryint, int> waytosave = new Dictionaryint, int>();Code
Dictionaryint ,int> numberControls = new Dictionaryint,int>();Code
Code
private void btnRun_Click(object sender, EventArgs e)Code
{Code
///Setting up the coordinatesCode
int xCoor;Code
int yCoor;Code
Random coor = new Random();Code
int value =7;Code
for (int x = 0; x value; x++)Code
{Code
//Creating Random NumeircalUpdown.Code
//Using those the user can change the values.Code
NumericUpDown numiNumber = new NumericUpDown();Code
xCoor = coor.Next(0, 500);Code
yCoor = coor.Next(0, 500);Code
numiNumber.Name = x.ToString();Code
numiNumber.Location = new Point(xCoor, yCoor);Code
numiNumber.Size = new System.Drawing.Size(50, 15);Code
numiNumber.Maximum = 100;Code
numiNumber.Minimum = 0;Code
//Saveing the numericalUpdownsCode
numberControls.Add(x, 0);Code
this.pnlNodes.Controls.Add(numiNumber);Code
Code
//Make it respond to the clicking eventCode
numiNumber.Click += new EventHandler(GetNumUpDownValue);Code
}Code
}Code
//Get the values for the NumericUpDownCode
public void GetNumUpDownValue(object sender, EventArgs e)Code
{Code
int iname = int.Parse(((NumericUpDown)sender).Name);Code
int ivalue = (int)((NumericUpDown)sender).Value;Code
Code
if (waytosave.ContainsKey(iname))Code
{Code
waytosave[iname] = ivalue;
}Code
elseCode
{ // otherwise add the key and valueCode
waytosave.Add(iname, ivalue);Code
}
Code
txtOutputs.Text += "\r\r\n" + " Node # " + iname + " = " + waytosave[iname].ToString();Code
}Code
Code
private void btnRoundRobin_Click(object sender, EventArgs e) {Code
//how can i get the saved information from the waytosave dictionaryCode
//Can you advise me please.Code
}Code

Lakshmanan Sethu SankaranarayanRank #124 · 17.7K reputationPosted May 23, 2014, 1:07 AM EDT
http://msdn.microsoft.com/en-us/library/bb347013(v=vs.110).aspx
Hiatham Al-Mawali5 reputationPosted May 23, 2014, 2:04 AM EDT
VulpesRank #55 · 29.2K reputationPosted May 23, 2014, 5:48 AM EDT