简体   繁体   English

如何在DevExpress GridControl的一行中获取该项目?

[英]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. 如果我双击该行的任何位置,则想将某行中某项的值(例如(0,y))分配给变量。

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 POSTSCRIPT:我正在使用VB.NET

Although you tag this with DevExpress-windows-ui you don't specifically state if this is traditional Winforms or WPF. 尽管您使用DevExpress-windows-ui对此进行了标记,但并未具体说明这是传统的Winforms还是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). 我没有使用Winforms控件的丰富经验,但是对于您尝试使用WPF网格所做的事情,我做了很多工作(我想这种方法大致相似)。

What you should be looking at is the GetCellValue method ( DevExpressMainDocumentation ). 您应该查看的是GetCellValue方法( 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. 您可能需要对知识库进行一些挖掘,但是您会发现许多示例来说明这一点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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