简体   繁体   中英

How can I get the item in a row of a DevExpress GridControl?

I want to know how I can assign the value of an item in a row to a variable.

If I double click in any position of the row, I want to assign the value of an item in a row, for example (0, y), to a variable.

Will be grateful if you provide something like that or some alternative.

Awaiting for your reply.

Thanks & regards, Renato Collado

POSTSCRIPT: I'm working with VB.NET

Although you tag this with DevExpress-windows-ui you don't specifically state if this is traditional Winforms or WPF. I don't have much experience using their Winforms controls but I have done a great deal of what you are trying to do with their WPF grids (and I would imagine that the approach to this is broadly similar).

What you should be looking at is the GetCellValue method ( DevExpressMainDocumentation ).

I tend to process my grids from external methods but as an example of the basic syntax;

Dim myValue as Boolean
For i As Integer = 0 To grid.VisibleRowCount - 1
    myValue = CBool(grid.GetCellValue(i, "SinglePayment")) 
    'Do stuff with myValue here 
Next

You may have to do a little digging around the knowledgebase but you will find numerous examples that illustrate this.

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