Click here to Skip to main content
15,912,977 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to embed a .exe file in c# windows application Pin
Dave Kreskowiak7-May-07 13:01
mveDave Kreskowiak7-May-07 13:01 
QuestionAdding Checkbox to List view Pin
satyam1432-May-07 3:40
satyam1432-May-07 3:40 
AnswerRe: Adding Checkbox to List view [modified] Pin
Tarakeshwar Reddy2-May-07 3:41
professionalTarakeshwar Reddy2-May-07 3:41 
GeneralRe: Adding Checkbox to List view Pin
satyam1432-May-07 3:47
satyam1432-May-07 3:47 
GeneralRe: Adding Checkbox to List view Pin
AFSEKI7-May-07 6:26
AFSEKI7-May-07 6:26 
QuestionInstallation program for multiple applications? Pin
Fredand132-May-07 3:38
Fredand132-May-07 3:38 
AnswerRe: Installation program for multiple applications? Pin
LongRange.Shooter2-May-07 4:59
LongRange.Shooter2-May-07 4:59 
QuestionGenerics Pin
Malcolm Smart2-May-07 3:21
Malcolm Smart2-May-07 3:21 
OK - new to generics (very...)

I have a DataTable which contains the data and I want to create classes that visually represent this data in different ways. Eg, a CheckBoxList and a ListBox.

So, hitting the keyboard I come up with :-

public class MyCheckBox : CheckBoxList
        {
            private BLL.myData _theData;
            public MyCheckBox(BLL.myData theData)
            {
                _theData = theData;
                DataSource = _theData.GetDataTable();
                DataValueField = "code";
                DataTextField = "desc";
                DataBind();
            }
        }

public class MyListBox : ListBox
        {
            private BLL.myData _theData;
            public MyListBox(BLL.myData theData)
            {
                _theData = theData;
                DataSource = _theData.GetDataTable();
                DataValueField = "code";
                DataTextField = "desc";
                DataBind();
            }
        }


In the front end (web) I can simply add an instance of these to the page and the databinding is taken care of. Cool. But...the code is identical in both classes apart from the derived class type, and the name I've given it.

How would I define a generic class which I can instantiate with the derived type?

I understand how to write generic classes which contain the <t> type, eg

(from memory...)
public class MyStack<T>
{
T[] arrayofMyThings;
}

but not how to create an instance of the <t> type - if that makes sense.?D'Oh! | :doh:


Regards

Angel
*********************************************


AnswerRe: Generics Pin
PIEBALDconsult2-May-07 3:43
mvePIEBALDconsult2-May-07 3:43 
GeneralRe: Generics Pin
Malcolm Smart2-May-07 3:53
Malcolm Smart2-May-07 3:53 
GeneralRe: Generics Pin
Ian Shlasko2-May-07 4:43
Ian Shlasko2-May-07 4:43 
GeneralRe: Generics Pin
Malcolm Smart2-May-07 4:52
Malcolm Smart2-May-07 4:52 
QuestionExport SQL server database to access database file using c#.net Pin
Malayil alex2-May-07 2:49
Malayil alex2-May-07 2:49 
AnswerRe: Export SQL server database to access database file using c#.net Pin
J$2-May-07 10:22
J$2-May-07 10:22 
QuestionTime conversion Pin
Anka_Ame2-May-07 2:42
Anka_Ame2-May-07 2:42 
AnswerRe: Time conversion Pin
Luc Pattyn2-May-07 3:04
sitebuilderLuc Pattyn2-May-07 3:04 
GeneralRe: Time conversion Pin
Anka_Ame2-May-07 3:11
Anka_Ame2-May-07 3:11 
GeneralRe: Time conversion Pin
Luc Pattyn2-May-07 4:06
sitebuilderLuc Pattyn2-May-07 4:06 
GeneralRe: Time conversion Pin
Malcolm Smart2-May-07 4:38
Malcolm Smart2-May-07 4:38 
AnswerRe: Time conversion Pin
Malcolm Smart2-May-07 3:31
Malcolm Smart2-May-07 3:31 
GeneralRe: Time conversion Pin
Anka_Ame2-May-07 3:36
Anka_Ame2-May-07 3:36 
GeneralRe: Time conversion Pin
Malcolm Smart2-May-07 3:46
Malcolm Smart2-May-07 3:46 
GeneralRe: Time conversion Pin
Anka_Ame2-May-07 4:21
Anka_Ame2-May-07 4:21 
GeneralRe: Time conversion Pin
Malcolm Smart2-May-07 4:35
Malcolm Smart2-May-07 4:35 
GeneralRe: Time conversion Pin
Anka_Ame2-May-07 5:01
Anka_Ame2-May-07 5:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.