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

C#

 
Questionaccessing controls of one form in another form Pin
MahaKh11-Aug-09 22:56
MahaKh11-Aug-09 22:56 
AnswerRe: accessing controls of one form in another form [modified] Pin
OriginalGriff11-Aug-09 23:41
mveOriginalGriff11-Aug-09 23:41 
QuestionApplication definition was successfully imported, but Entity X has no identifiers defined in the SpecificFinder view Pin
hdv21211-Aug-09 22:38
hdv21211-Aug-09 22:38 
QuestionHow to convert .MPP File to .XML File in C# Pin
Rajesh_K_Sharma11-Aug-09 22:27
Rajesh_K_Sharma11-Aug-09 22:27 
AnswerRe: How to convert .MPP File to .XML File in C# Pin
Alenzo_Eid10-Mar-10 0:45
Alenzo_Eid10-Mar-10 0:45 
QuestionHow to Split one datatable to many datatables? Pin
NguyenDzung11-Aug-09 21:58
NguyenDzung11-Aug-09 21:58 
AnswerRe: How to Split one datatable to many datatables? Pin
dan!sh 11-Aug-09 22:14
professional dan!sh 11-Aug-09 22:14 
AnswerRe: How to Split one datatable to many datatables? PinPopular
Pete O'Hanlon11-Aug-09 22:36
mvePete O'Hanlon11-Aug-09 22:36 
The simplest way would be to write a loop that iterated over the DataTable and allocate rows accordingly. When you do this, you need to clone the table structure, and use ImportRow to copy the row from one table to another. If you attempt to copy the row over directly, you'll get a "row belongs to another table" error. The following method does what you want:
private List<DataTable> CloneTable(DataTable tableToClone, int countLimit)
{
    List<DataTable> tables = new List<DataTable>();
    int count = 0;
    DataTable copyTable = null;
    foreach (DataRow dr in tableToClone.Rows)
    {
        if ((count++ % countLimit) == 0)
        {
            copyTable = new DataTable();
            // Clone the structure of the table.
            copyTable = tableToClone.Clone();
            // Add the new DataTable to the list.
            tables.Add(copyTable);
        }
        // Import the current row.
        copyTable.ImportRow(dr);
    }
    return tables;
}


"WPF has many lovers. It's a veritable porn star!" - Josh Smith

As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.


My blog | My articles | MoXAML PowerToys | Onyx



GeneralRe: How to Split one datatable to many datatables? Pin
NguyenDzung12-Aug-09 17:40
NguyenDzung12-Aug-09 17:40 
GeneralRe: How to Split one datatable to many datatables? Pin
Prince Antony G5-Jan-12 22:32
Prince Antony G5-Jan-12 22:32 
QuestionGet what object a button belongs to? Pin
xkrja11-Aug-09 21:54
xkrja11-Aug-09 21:54 
AnswerRe: Get what object a button belongs to? Pin
Pete O'Hanlon11-Aug-09 21:58
mvePete O'Hanlon11-Aug-09 21:58 
GeneralRe: Get what object a button belongs to? Pin
xkrja11-Aug-09 22:09
xkrja11-Aug-09 22:09 
AnswerRe: Get what object a button belongs to? Pin
stancrm11-Aug-09 22:07
stancrm11-Aug-09 22:07 
GeneralRe: Get what object a button belongs to? Pin
xkrja11-Aug-09 22:19
xkrja11-Aug-09 22:19 
AnswerRe: Get what object a button belongs to? Pin
Luc Pattyn11-Aug-09 23:59
sitebuilderLuc Pattyn11-Aug-09 23:59 
AnswerRe: Get what object a button belongs to? Pin
Daniel Grunwald12-Aug-09 2:53
Daniel Grunwald12-Aug-09 2:53 
Questiontext box multiline Pin
Vivek Vijayan11-Aug-09 21:37
Vivek Vijayan11-Aug-09 21:37 
AnswerRe: text box multiline Pin
stancrm11-Aug-09 21:44
stancrm11-Aug-09 21:44 
AnswerRe: text box multiline Pin
Ashfield11-Aug-09 21:44
Ashfield11-Aug-09 21:44 
AnswerRe: text box multiline Pin
dan!sh 11-Aug-09 22:18
professional dan!sh 11-Aug-09 22:18 
QuestionException in access to textbox ? Pin
Mohammad Dayyan11-Aug-09 21:30
Mohammad Dayyan11-Aug-09 21:30 
AnswerRe: Exception in access to textbox ? Pin
stancrm11-Aug-09 21:40
stancrm11-Aug-09 21:40 
GeneralRe: Exception in access to textbox ? Pin
Mohammad Dayyan12-Aug-09 0:15
Mohammad Dayyan12-Aug-09 0:15 
AnswerRe: Exception in access to textbox ? Pin
Luc Pattyn12-Aug-09 0:01
sitebuilderLuc Pattyn12-Aug-09 0: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.