基于DataGridGiew上的多个选定单元格获取RowIndex [英] Getting RowIndex based on the multiple selected cells on a DataGridGiew

查看:111
本文介绍了基于DataGridGiew上的多个选定单元格获取RowIndex的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图根据DataGridView上的多个选定单元格获取行索引。我怎么能在VB.NET中做到这一点?



这就是我所拥有的:



 如果 e.RowIndex> =  0  然后 
Dim As DataGridViewRow
row = < span class =code-keyword> Me .DataGridView1.Rows(e.RowIndex)
sno.Text = row.Cells( F2)。Value.ToString
sname.Text = row.Cells( F3)。Value.ToString
final.Text = row.Cells( F16)。Value.ToString
结束 如果

解决方案

从这里开始:如何:获取Windows窗体DataGridView控件中的选定单元格,行和列 [ ^ ]

Im trying to get the row indices based on my multiple selected cells on a DataGridView. How can I do that in VB.NET?

This is what I have:

If e.RowIndex >= 0 Then
            Dim row As DataGridViewRow
            row = Me.DataGridView1.Rows(e.RowIndex)
            sno.Text = row.Cells("F2").Value.ToString
            sname.Text = row.Cells("F3").Value.ToString
            final.Text = row.Cells("F16").Value.ToString
        End If

解决方案

Start here: How to: Get the Selected Cells, Rows, and Columns in the Windows Forms DataGridView Control[^]


这篇关于基于DataGridGiew上的多个选定单元格获取RowIndex的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆