tentmaking
tentmaking

Reputation: 2146

How to give a Button a special identifier

I am writing an app that generates and saves color schemes. I need to be able to select a color schemes base color and delete that color scheme. Each color scheme is represented by a series of buttons (the base color is a button and the other shades are buttons). When I click on the button, that represents the base color of a color scheme, I need to be able to get what color scheme that button belongs to.

Basically, I need to attach a special identifier (a string) to a button when it is created so I can identify it later. Does anyone know of a way to do this? I am using WinForms (unfortunately).

Upvotes: 0

Views: 349

Answers (1)

Robert Harvey
Robert Harvey

Reputation: 180908

There is a Tag property on the Button class (derived from Control) that accepts an arbitrary object. You can put anything in there you want.

Upvotes: 4

Related Questions