Click here to Skip to main content
15,897,187 members
Home / Discussions / C#
   

C#

 
AnswerRe: Custom Control / Property Grid Pin
darkelv20-Jul-08 23:27
darkelv20-Jul-08 23:27 
GeneralRe: Custom Control / Property Grid Pin
c242320-Jul-08 23:30
c242320-Jul-08 23:30 
QuestionFormat BoundColumn Text Pin
Member 426786720-Jul-08 23:07
Member 426786720-Jul-08 23:07 
AnswerRe: Format BoundColumn Text Pin
C1AllenS21-Jul-08 0:43
C1AllenS21-Jul-08 0:43 
GeneralRe: Format BoundColumn Text Pin
Member 426786721-Jul-08 0:48
Member 426786721-Jul-08 0:48 
GeneralRe: Format BoundColumn Text Pin
leppie21-Jul-08 3:46
leppie21-Jul-08 3:46 
QuestionRegarding Log4Net tool to clean the data older than 60 days Pin
rajesh4u20-Jul-08 22:49
rajesh4u20-Jul-08 22:49 
AnswerRe: Regarding Log4Net tool to clean the data older than 60 days Pin
leppie20-Jul-08 23:03
leppie20-Jul-08 23:03 
GeneralRe: Regarding Log4Net tool to clean the data older than 60 days Pin
rajesh4u20-Jul-08 23:32
rajesh4u20-Jul-08 23:32 
GeneralRe: Regarding Log4Net tool to clean the data older than 60 days Pin
Paddy Boyd21-Jul-08 2:34
Paddy Boyd21-Jul-08 2:34 
GeneralRe: Regarding Log4Net tool to clean the data older than 60 days Pin
rajesh4u22-Jul-08 1:30
rajesh4u22-Jul-08 1:30 
AnswerRe: Regarding Log4Net tool to clean the data older than 60 days Pin
nelsonpaixao21-Jul-08 13:20
nelsonpaixao21-Jul-08 13:20 
Questional excel sheets from different files into one new file Pin
Member 232322620-Jul-08 22:43
Member 232322620-Jul-08 22:43 
AnswerRe: al excel sheets from different files into one new file Pin
nelsonpaixao21-Jul-08 13:27
nelsonpaixao21-Jul-08 13:27 
GeneralRe: all excel sheets from different files into one new file Pin
Member 232322621-Jul-08 22:33
Member 232322621-Jul-08 22:33 
QuestionCan I get the DataTable properties from an arbitrary DataRow? Pin
JoeRip20-Jul-08 22:36
JoeRip20-Jul-08 22:36 
I have a method which takes a DataRow as an out argument. The method fills out the DataRow with data, and returns it.

So,

public CreateTheFancyTable()
{
     DataTable dt = new DataTable();
     DataColumn dc1 = new DataColumn("First_Column", System.Int32);
     DataColumn dc2 = new DataColumn("Second_Column", System.String);
     dc1.AllowDBNull = false;
     dc2.AlllowDBNull = false;
     DataRow dr = dt.NewRow();

bool fSucceeded = FillOutMyRow(dr);
}

public bool FillOutMyRow(DataRow dr)
{
     // fetch some data from an outside source here

     // fill out the row here

     dr["First_Column"] = 1;
     dr["Second_Column"] = "";
}

Please don't focus on the bugs in my quick sample here, the real code is a lot more complex than this.

Now, the last line is going to fail, because dt.Columns[dc2].AllowDBNull is false.

How, in the code of FillOutMyRow(), can I find out the properties of the columns in the row that was passed to me? I only know how to get the column properties of a table, and I don't have the table.

Can I refer directly to the column properties of a row (and if so, how?)? Or do I need to get the parent container of the row (the table), and if so, how?

Thanks,

Joe
AnswerRe: Can I get the DataTable properties from an arbitrary DataRow? Pin
leppie20-Jul-08 22:58
leppie20-Jul-08 22:58 
GeneralRe: Can I get the DataTable properties from an arbitrary DataRow? Pin
JoeRip20-Jul-08 23:00
JoeRip20-Jul-08 23:00 
AnswerRe: Can I get the DataTable properties from an arbitrary DataRow? Pin
J4amieC20-Jul-08 22:59
J4amieC20-Jul-08 22:59 
QuestionRe: Can I get the DataTable properties from an arbitrary DataRow? Pin
JoeRip20-Jul-08 23:06
JoeRip20-Jul-08 23:06 
AnswerRe: Can I get the DataTable properties from an arbitrary DataRow? Pin
leppie20-Jul-08 23:24
leppie20-Jul-08 23:24 
GeneralRe: Can I get the DataTable properties from an arbitrary DataRow? Pin
J4amieC21-Jul-08 0:05
J4amieC21-Jul-08 0:05 
AnswerRe: Can I get the DataTable properties from an arbitrary DataRow? Pin
J4amieC21-Jul-08 0:06
J4amieC21-Jul-08 0:06 
GeneralRe: Can I get the DataTable properties from an arbitrary DataRow? Pin
JoeRip21-Jul-08 0:21
JoeRip21-Jul-08 0:21 
GeneralRe: Can I get the DataTable properties from an arbitrary DataRow? Pin
J4amieC21-Jul-08 0:49
J4amieC21-Jul-08 0:49 

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.