To get a collection of DataGridViewItems (I hope your '
grdItems
' is standard
DataGridView
???) you have to use
grdItems.Items()
. But if you set
a
('
ColumnIndex
') and
b
('
RowIndex
') the same as CurrentCell's Col- and Row- indexes, your
Me.grdItems.CurrentCell = Me.grdItems.Items(a, b)
will
always True
. And
everytime you will get a
MsgBox
.
I don't understand what your project does, but it seems to me that you mean an independent 'CurrentCell' which
ColumnIndex
and
RowIndex
are predefined variables. And when user moves through a collection of
DataGridViewItem
(using 'Tab' key), you want to catch if coordinates of your 'CurrentCell' will the same as coordinates of
grdItems.CurrentCell
.
Right?.. But what for?
DataGridView
offers a lot of useful events, properties and methods that allow you to work with different types of cells, their decoration and values.