Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: CurrentRowIndexの定義がない?

188 views
Skip to first unread message

Kaoru Kodaka

unread,
Nov 4, 2005, 9:49:10 PM11/4/05
to
かおく です。

On Fri, 4 Nov 2005 18:19:05 -0800
"cs" <c...@discussions.microsoft.com> wrote:

> 'System.Windows.Forms.DataGridView' に 'CurrentRowIndex'の定義がありません。
> と表示されて、驚いてしまいました。

ヘルプによれば、CurrentRow プロパティはありますが、
CurrentRowIndex というプロパティはありませんね。

---
MVP kaok = MVP.ChangeMvpCategory("for C# 2004-2006.");
kaok.Web = "http://www.antoine.st/";

Kaoru Kodaka

unread,
Nov 4, 2005, 11:11:36 PM11/4/05
to
かおく です。

On Fri, 4 Nov 2005 19:07:03 -0800
"cs" <c...@discussions.microsoft.com> wrote:

> 私のしりたいことと、この記事とは無関係だったのでしょうか?

DataGrid と DataGridView は別物ですよ。DataGrid には、件のプ
ロパティが存在します。

しかし、DataGrid は DataGridView に置き換えられるというもの
ですので、特に理由がないのであれば、DataGridView を使うほう
がよさそうですね。

DataGridView であれば、CurrentRow.Index で CurrentRowIndex
相当の値が取得できそうです。

Kaoru Kodaka

unread,
Nov 5, 2005, 1:52:52 AM11/5/05
to
かおく です。

On Fri, 4 Nov 2005 21:32:01 -0800
"cs" <c...@discussions.microsoft.com> wrote:

> 今度は、Getでなく、Setするには、というものです。

CurrentRow のヘルプトピックに、

|| To change the current row, you must set the CurrentCell
|| property to a cell in the desired row.

とあります。CurrentCell プロパティを使うようですね。

cs

unread,
Nov 5, 2005, 2:22:01 AM11/5/05
to
> > myGrid.CurrentRow.Index = selectIndex; などとすると、
> >
> > 'System.Windows.Forms.DataGridViewBand' は読み取り専用なので、
> > 割り当てることはできません。
> >
> > と表示されます。

myGrid
と入力した後で、ピリオドを打つと、スニペットが現れて、
CurrentCellをポイントしたうえで、それを読むと、

DataGridViewCell DataGridView.CurrentCell
Gets or sets the currently active cell.

と表示されます。そこで、CurrentCellとピリオドを入力すると
次の候補がスニペットに表示されます。
これを1つずつ読んでいくと、

RowIndex では、
int DataGridViewCell.RowIndex
Gets the index of the cell's parent row.
と表示されますので、これではSet(割り当て)できないことが分かりました。

それでは違うものをと、探しても、
DataGridViewの表示位置(行)を設定しそうなものが見当たりません。

そして、CurrentCell の代わりに、CurrentRow で、設定できるのかと、
これもスニペットで読んでみても、Getのみで、
Gets the row containing the current cell.
と、表示されます。

それらしいような、CurrentCellAddressもだめ、
dailyGrid.FirstDisplayedCell.RowIndex = iPos; では読み取り専用。

もしや、メソッドを作り忘れたのでは???
そんなことはないでしょうけれど。

0 new messages