nigs
nigs

Reputation: 21

Using a resource image name as a listbox list item C#

I am trying to produce a list in a listbox using C# in VS2012, the idea is to click on one of many picture boxes which contain images stored as resources, as the different boxes are clicked, I want the action event to add the name property as a list item in the ListBox.

I got it to add the string System.drawing.bitmap using :

    private void PB1_Click( object sender, EventArgs e )
  {
     LB1.Items.Add(PB1.Image.ToString());               
  }

and

   private void PB1_Click( object sender, EventArgs e )
  {
     LB1.Items.Add(Properties.Resources.wrist1.ToString());           
  }

But I can't seem to find an access to the Object property 'Name'. I tried wrist1.GetPropertyItem(Name) but it throws an error and will only accept an int.

any ideas anyone???

Upvotes: 1

Views: 290

Answers (1)

user2259020
user2259020

Reputation:

private void PB1_Click( object sender, EventArgs e )
{
LB1.Items.Add(this.Name);
}

And name each PictureBox properly. ?

Upvotes: 1

Related Questions