title: How to submit extra values in listbox c#?
body: <p>I've got a question, and I can't find an answer to it. First off all, I'm a noob in programming, so all constructive feedback is of course welcome. </p>
  
  <p>We are working on a program in c#. In a listbox, I've put objects (rectangles). The paramaters (well, only the color, as the height and width is fixed) of these rectangle's are saved into a database. But I want to give each object in the listbox an extra value (to be precise, I want to give the id of the object in the database). So that later on, I can get the ID of the selected item in the listbox. Is this possible? </p>
  
  <pre><code> //########## TOEVOEGEN VAN KLEUR AAN LISTBOX MET KLEURTJES + INITIALISATIE
          var queryKLeurenInDatabase = (from kleurtjes in dbo.tblKleurs
                                        select kleurtjes);
          foreach (var item in queryKLeurenInDatabase)
          {
              int red, green, blue,ID;
              Rectangle kleurBox = new Rectangle();
              kleurBox.Height = 18;
              kleurBox.Width = 160;
              red = item.Red.Value;
              green = item.Green.Value;
              blue = item.Blue.Value;
              ID = item.KleurID;
              kleurBox.Fill = new SolidColorBrush(new Color() { R = Convert.ToByte(red), G = Convert.ToByte(green), B = Convert.ToByte(blue), A = 255 });
              ListItem dataItem = new ListItem();
              dataItem.Tag = ID;                
              listBoxOpgeslagenKleuren.Items.Add(kleurBox);
              //ListItem dataItem = new ListItem();
              //dataItem.Text = "value to show";
              //dataItem.Value = *another value you want *;
              //listBox.Items.Add(dataItem);
          }
  </code></pre>