CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2007
    Posts
    405

    Why can't I add a record to Devexpress's gridView ?

    I have the following code, when I run it, I can't add a new line to the gridView, thanks for your help:

    Code:
    ...
              for (int i = 0; i < dt.Rows.Count; i++)
                {
                    try
                    {
                        // Add into gridView
                        gridView1.AddNewRow();
    
                        // Set rowHandle
                        int rowHandle = gridView1.GetRowHandle(gridView1.DataRowCount);
                        if (gridView1.IsNewItemRow(rowHandle))
                        {
                            gridView1.SetRowCellValue(rowHandle, gridView1.Columns["ID"], i);
                            gridView1.SetRowCellValue(rowHandle, gridView1.Columns["Name"], "Peter");
                            gridView1.SetRowCellValue(rowHandle, gridView1.Columns["Age"], 35);
    
                            // Update gridView
                            gridView1.UpdateCurrentRow();
                        }
                        else
                        {
                            Debug.Print("Not row new!");
                        }
                    }
                    catch (Exception ex)
                    {
                        Debug.Print("Exception ex: " + ex);
                    }
                }
    ...

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Why can't I add a record to Devexpress's gridView ?

    Quote Originally Posted by dongtrien View Post
    I have the following code, when I run it, I can't add a new line to the gridView ...
    And what happens?
    Victor Nijegorodov

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