Im new to C# and I only want to know how to set an objects tag to a number for example
button a= new button();
a.parent=this;
...
a.tag=12; (but it says it must be an object and I dont want to pass an object to it , any int to object conversion?)

You can use a string, it is an object.
If you absolutely need an int, you can create a small class :

public class Tag {public int value = 0;}

that you use in your form :

Tag tag = new Tag {value = 12};
this.button1.Tag = tag;

No need to create a class, just force it to box the value:
this.button1.Tag = (object)12;

But remember, when you go to retrieve it, it will be of type Object, you'll have to cast it back into whatever you need it to be.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.