Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Ruft einen Wert ab, der angibt, ob eine angegebene Zeile ausgewählt ist.
Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)
Syntax
'Declaration
Public Function IsSelected ( _
row As Integer _
) As Boolean
'Usage
Dim instance As DataGrid
Dim row As Integer
Dim returnValue As Boolean
returnValue = instance.IsSelected(row)
public bool IsSelected (
int row
)
public:
bool IsSelected (
int row
)
public boolean IsSelected (
int row
)
public function IsSelected (
row : int
) : boolean
Parameter
- row
Die Nummer der gewünschten Zeile.
Rückgabewert
true, wenn die Zeile ausgewählt ist, andernfalls false.
Beispiel
' Check if the first row is selected.
Private Sub button8_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button8.Click
If myDataGrid.IsSelected(0) Then
MessageBox.Show("Row selected", "Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Else
MessageBox.Show("Row not selected", "Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End If
End Sub 'button8_Click
' Deselect the first row.
Private Sub button11_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button11.Click
myDataGrid.UnSelect(0)
End Sub 'button11_Click
// Check if the first row is selected.
private void button8_Click(object sender, EventArgs e)
{
if(myDataGrid.IsSelected(0))
{
MessageBox.Show("Row selected",
"Message", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
}
else
{
MessageBox.Show("Row not selected",
"Message", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
}
}
// Deselect the first row.
private void button11_Click(object sender, EventArgs e)
{
myDataGrid.UnSelect(0);
}
// Check if the first row is selected.
private:
void button8_Click( Object^ /*sender*/, EventArgs^ /*e*/ )
{
if ( myDataGrid->IsSelected( 0 ) )
{
MessageBox::Show( "Row selected", "Message", MessageBoxButtons::OK, MessageBoxIcon::Exclamation );
}
else
{
MessageBox::Show( "Row not selected", "Message", MessageBoxButtons::OK, MessageBoxIcon::Exclamation );
}
}
// Deselect the first row.
void button11_Click( Object^ /*sender*/, EventArgs^ /*e*/ )
{
myDataGrid->UnSelect( 0 );
}
// Check if the first row is selected.
private void button8_Click(Object sender, EventArgs e)
{
if (myDataGrid.IsSelected(0)) {
MessageBox.Show("Row selected", "Message", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
}
else {
MessageBox.Show("Row not selected", "Message", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
}
} //button8_Click
// Deselect the first row.
private void button11_Click(Object sender, EventArgs e)
{
myDataGrid.UnSelect(0);
} //button11_Click
Plattformen
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
.NET Compact Framework
Unterstützt in: 2.0, 1.0
Siehe auch
Referenz
DataGrid-Klasse
DataGrid-Member
System.Windows.Forms-Namespace