CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2010
    Location
    .NET 3.5, VisualStudio-2008
    Posts
    30

    [RESOLVED] Adding rows to datagridview programatically

    Hi all,

    Could someone tell me how to add rows to a datagridview programatically. This datagridview is already bounded to a table containing one row present in the SQL server (i.e the database), Now i want to add rows dynamically when it satisfies some condition..

    Please help......

  2. #2
    Join Date
    Nov 2007
    Location
    .NET 3.5 / VS2008 Developer
    Posts
    624

    Re: Adding rows to datagridview programatically

    how are you binding? If you are using a DataTable, then simply add additional rows to the DataTable.
    ===============================
    My Blog

  3. #3
    Join Date
    Jul 2010
    Posts
    82

    Re: Adding rows to datagridview programatically

    You can get the datasource its bounded to, get its datatable, add new rows and refresh. Do you want an example? Let me know.

    Regards,
    CT.

    Check out www.cuteassistant.com - Manage your tasks, take notes, securely store data and more!

  4. #4
    Join Date
    Mar 2010
    Location
    .NET 3.5, VisualStudio-2008
    Posts
    30

    Re: Adding rows to datagridview programatically

    Hi,

    I created a datarow, and added it to the respective dataset.......it works fine

  5. #5
    Join Date
    Jul 2010
    Posts
    82

    Re: Adding rows to datagridview programatically

    Quote Originally Posted by daffodils180 View Post
    Hi,

    I created a datarow, and added it to the respective dataset.......it works fine
    Great. Its easier as well. Can you please mark it as Resolved ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured