combinations from 1 to n array and fill datagridview C#





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















EDIT



I need to fill a datagridview with all possible combinations of an array of 5 numbers which has range from 1 to n. (n lets say 100). My datagrid columns are Number1, Number2 Number3, Number4, Number 5.



I have read this
What is the best way to find all combinations of items in an array?



but I need to do the calculation on a button click and then fill the datagridview. Is that possible? thank you!










share|improve this question

























  • The answer is yes. Perhaps you need to ask for more detail?

    – Enigmativity
    Jan 3 at 13:06











  • Yes you are right...I need some help actually with tha math type...thank you

    – touinta
    Jan 3 at 13:07











  • You array contains only distinct numbers?

    – Lev Z
    Jan 3 at 15:01











  • Start with an array of 5 numbers. In a for-loop extract one number and return the remaining (array.Except(new { x }).ToArray()) numbers. Recurse until you have an empty array.

    – Enigmativity
    Jan 3 at 22:32


















0















EDIT



I need to fill a datagridview with all possible combinations of an array of 5 numbers which has range from 1 to n. (n lets say 100). My datagrid columns are Number1, Number2 Number3, Number4, Number 5.



I have read this
What is the best way to find all combinations of items in an array?



but I need to do the calculation on a button click and then fill the datagridview. Is that possible? thank you!










share|improve this question

























  • The answer is yes. Perhaps you need to ask for more detail?

    – Enigmativity
    Jan 3 at 13:06











  • Yes you are right...I need some help actually with tha math type...thank you

    – touinta
    Jan 3 at 13:07











  • You array contains only distinct numbers?

    – Lev Z
    Jan 3 at 15:01











  • Start with an array of 5 numbers. In a for-loop extract one number and return the remaining (array.Except(new { x }).ToArray()) numbers. Recurse until you have an empty array.

    – Enigmativity
    Jan 3 at 22:32














0












0








0








EDIT



I need to fill a datagridview with all possible combinations of an array of 5 numbers which has range from 1 to n. (n lets say 100). My datagrid columns are Number1, Number2 Number3, Number4, Number 5.



I have read this
What is the best way to find all combinations of items in an array?



but I need to do the calculation on a button click and then fill the datagridview. Is that possible? thank you!










share|improve this question
















EDIT



I need to fill a datagridview with all possible combinations of an array of 5 numbers which has range from 1 to n. (n lets say 100). My datagrid columns are Number1, Number2 Number3, Number4, Number 5.



I have read this
What is the best way to find all combinations of items in an array?



but I need to do the calculation on a button click and then fill the datagridview. Is that possible? thank you!







c# datagridview






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 3 at 12:32







touinta

















asked Jan 3 at 12:17









touintatouinta

3953518




3953518













  • The answer is yes. Perhaps you need to ask for more detail?

    – Enigmativity
    Jan 3 at 13:06











  • Yes you are right...I need some help actually with tha math type...thank you

    – touinta
    Jan 3 at 13:07











  • You array contains only distinct numbers?

    – Lev Z
    Jan 3 at 15:01











  • Start with an array of 5 numbers. In a for-loop extract one number and return the remaining (array.Except(new { x }).ToArray()) numbers. Recurse until you have an empty array.

    – Enigmativity
    Jan 3 at 22:32



















  • The answer is yes. Perhaps you need to ask for more detail?

    – Enigmativity
    Jan 3 at 13:06











  • Yes you are right...I need some help actually with tha math type...thank you

    – touinta
    Jan 3 at 13:07











  • You array contains only distinct numbers?

    – Lev Z
    Jan 3 at 15:01











  • Start with an array of 5 numbers. In a for-loop extract one number and return the remaining (array.Except(new { x }).ToArray()) numbers. Recurse until you have an empty array.

    – Enigmativity
    Jan 3 at 22:32

















The answer is yes. Perhaps you need to ask for more detail?

– Enigmativity
Jan 3 at 13:06





The answer is yes. Perhaps you need to ask for more detail?

– Enigmativity
Jan 3 at 13:06













Yes you are right...I need some help actually with tha math type...thank you

– touinta
Jan 3 at 13:07





Yes you are right...I need some help actually with tha math type...thank you

– touinta
Jan 3 at 13:07













You array contains only distinct numbers?

– Lev Z
Jan 3 at 15:01





You array contains only distinct numbers?

– Lev Z
Jan 3 at 15:01













Start with an array of 5 numbers. In a for-loop extract one number and return the remaining (array.Except(new { x }).ToArray()) numbers. Recurse until you have an empty array.

– Enigmativity
Jan 3 at 22:32





Start with an array of 5 numbers. In a for-loop extract one number and return the remaining (array.Except(new { x }).ToArray()) numbers. Recurse until you have an empty array.

– Enigmativity
Jan 3 at 22:32












1 Answer
1






active

oldest

votes


















-1














The best way to fill datagridview is just by binding it to a dataTable...
so if you know how to do the math...
and if you know how to trigger a button click event...
just build a dataTable with all the columns and rows you need and when it's ready..
just do MyDataGridView.DataSource=MyDataTable...






share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54022154%2fcombinations-from-1-to-n-array-and-fill-datagridview-c-sharp%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    -1














    The best way to fill datagridview is just by binding it to a dataTable...
    so if you know how to do the math...
    and if you know how to trigger a button click event...
    just build a dataTable with all the columns and rows you need and when it's ready..
    just do MyDataGridView.DataSource=MyDataTable...






    share|improve this answer




























      -1














      The best way to fill datagridview is just by binding it to a dataTable...
      so if you know how to do the math...
      and if you know how to trigger a button click event...
      just build a dataTable with all the columns and rows you need and when it's ready..
      just do MyDataGridView.DataSource=MyDataTable...






      share|improve this answer


























        -1












        -1








        -1







        The best way to fill datagridview is just by binding it to a dataTable...
        so if you know how to do the math...
        and if you know how to trigger a button click event...
        just build a dataTable with all the columns and rows you need and when it's ready..
        just do MyDataGridView.DataSource=MyDataTable...






        share|improve this answer













        The best way to fill datagridview is just by binding it to a dataTable...
        so if you know how to do the math...
        and if you know how to trigger a button click event...
        just build a dataTable with all the columns and rows you need and when it's ready..
        just do MyDataGridView.DataSource=MyDataTable...







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 3 at 12:50









        Idan MarkoIdan Marko

        92




        92
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54022154%2fcombinations-from-1-to-n-array-and-fill-datagridview-c-sharp%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            MongoDB - Not Authorized To Execute Command

            How to fix TextFormField cause rebuild widget in Flutter

            Npm cannot find a required file even through it is in the searched directory