简体   繁体   中英

How to add rows in devexpress gridcontrol by code

I wonder if there is an option to add rows in devexpress GridControl,I have a datasource from database but i need add first row Manual then add datasores. It can be done in a normal datagridview Like this:


Dim I = datagridview1.Row.add
datagridview1.row.add(i).Cells(1).Value="test"

*********************

**** fill gridview1 from database
Dim h dt.Rows.Count
For M=0 to dt.Rows.Conunt-1
     Dim f = datagridview1.Rows.add
           datagridview1.Rows(f).Cells(0).value=dt.Rows(M).Item
 Next ```

Of course. Your code should be something like this:

 datagridview1.AddNewRow()
 datagridview1.SetRowCellValue(gridView1.RowCount - 1; , datagridview1.Columns(0), 'A')  
 datagridview1.SetRowCellValue(gridView1.RowCount - 1; , datagridview1.Columns(0), 'B')  
 datagridview1.SetRowCellValue(gridView1.RowCount - 1; , datagridview1.Columns(0), 'C')  

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM