Component programming

  • Thread starter Thread starter nht
  • Start date Start date
N

nht

Hi, i have a question. I want to create my own components in C#. But i
want to create non visual components like datasets,data adapters etc.
How can i do that? From which class i must inherit my component?
 
A non-visual component should derive from Control and not from UserControl
You can take controls like DataAdapter and SqlConnection, write properties
and methods that you want to expose and add it to the toolbox of client
project.
The code for component can contain properties and methods as follows:

public DataTable OrdersTable
{
get { return dsOrders1.Orders; }
}

public DataTable OrderDetailsTable
{
get { return dsOrders1.Order_Details; }
}

public DataRowCollection GetOrders(string custId)
{
daOrders.SelectCommand.CommandText = "select * from Orders where
customerId = '" + custId + "'";
daOrders.Fill(dsOrders1, "Orders");
return dsOrders1.Orders.Rows;
}

Hope this helps.
Sameeksha
(MCAD.Net)
 
nht,

You would inherit from Component, or implement the IComponent interface.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top