creating reusable components? (example: a questionbox)

5 replies [Last post]
Posts: 458

Okay to keep it simple I want to create the following component:

a questionbox.
it takes: string question,int x, int y, int width, int height
it returns: string answer

i can easily add this into my vocabulary trainer project,
but how can i write it to be reusable as in:

i create a new project and add this class into my project.
how to make this class project-less? or something.
I dont like the idea of copy paste xD

also can i have it independant as a windows form?

Posts: 531

what do you mean by independant as a windows form?
other than adding an "existing item" into your new project i.e. "yourclass.cs" then i can't see what you mean by making a projectless class. you'd just have a file then

There are 10 types of people in this world - Those who understand Binary and those who don't.

Posts: 458

thats what i mean.
can i create a windows form and use it like this?

Posts: 164

I'm not exactly sure what your saying, but if you have made this component and have Visual Studio, you can create a user template. Then you can insert the class whenever you want into any project that references System.Windows.Forms. (and whatever other dlls it needs)

Posts: 531

zanval wrote:
thats what i mean. can i create a windows form and use it like this?

sorry i didn't reply on this one i forgot about this thread Laughing out loud

if you mean can i create a windows form- save it- use the file again in other projects, then as long as you reference everything the form needs (it might not even need any referencing) then yes.

There are 10 types of people in this world - Those who understand Binary and those who don't.

Posts: 458

well it references basic .Net

so thanks Laughing out loud