//Create the dictionaries
Dictionary<int, int> waytosave = new Dictionary<int, int>();
Dictionary<int ,int> numberControls = new Dictionary<int,int>();
private void btnRun_Click(object sender, EventArgs e)
{
///Setting up the coordinates
int xCoor;
int yCoor;
Random coor = new Random();
int value =7;
for (int x = 0; x < value; x++)
//Creating Random NumeircalUpdown.
//Using those the user can change the values.
NumericUpDown numiNumber = new NumericUpDown();
xCoor = coor.Next(0, 500);
yCoor = coor.Next(0, 500);
numiNumber.Name = x.ToString();
numiNumber.Location = new Point(xCoor, yCoor);
numiNumber.Size = new System.Drawing.Size(50, 15);
numiNumber.Maximum = 100;
numiNumber.Minimum = 0;
//Saveing the numericalUpdowns
numberControls.Add(x, 0);
this.pnlNodes.Controls.Add(numiNumber);
//Make it respond to the clicking event
numiNumber.Click += new EventHandler(GetNumUpDownValue);
}
//Get the values for the NumericUpDown
public void GetNumUpDownValue(object sender, EventArgs e)
int iname = int.Parse(((NumericUpDown)sender).Name);
int ivalue = (int)((NumericUpDown)sender).Value;
if (waytosave.ContainsKey(iname))
if
waytosave[iname] = ivalue; }
else
{ // otherwise add the key and value
waytosave.Add(iname, ivalue);
txtOutputs.Text += "\r\r\n" + " Node # " + iname + " = " + waytosave[iname].ToString();
private void btnRoundRobin_Click(object sender, EventArgs e) {
//how can i get the saved information from the waytosave dictionary
//Can you advise me please.