PC Review


Reply
Thread Tools Rate Thread

How do I do this in DataGridView?

 
 
B. Chernick
Guest
Posts: n/a
 
      6th Oct 2008
Here's the basic scenario. A WinForms application with a datagridview bound
to a ObjectDataSource (VB/Dot Net 2.0) Adding is permitted.

What I would like to do is this: When entering the add row, if I am not in
the first column, immediately switch to the first column.

---------------------

I've been trying variations on this but I keep getting an error: Operation
is not valid because it results in a reentrant call to the
SetCurrentCellAddressCore function.

What is this? (I have yet to find a clear explaination anywhere on the web.)

Private Sub dgvParts_RowEnter(ByVal sender As Object, ByVal e As
System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvParts.RowEnter
If dgvParts.Rows(e.RowIndex).IsNewRow Then
dgvParts.CurrentCell = dgvParts.CurrentRow.Cells(0)
End If
End Sub
 
Reply With Quote
 
 
 
 
B. Chernick
Guest
Posts: n/a
 
      6th Oct 2008
Sorry. Cancel this. Wrong assumptions. Another event was interferring.

"B. Chernick" wrote:

> Here's the basic scenario. A WinForms application with a datagridview bound
> to a ObjectDataSource (VB/Dot Net 2.0) Adding is permitted.
>
> What I would like to do is this: When entering the add row, if I am not in
> the first column, immediately switch to the first column.
>
> ---------------------
>
> I've been trying variations on this but I keep getting an error: Operation
> is not valid because it results in a reentrant call to the
> SetCurrentCellAddressCore function.
>
> What is this? (I have yet to find a clear explaination anywhere on the web.)
>
> Private Sub dgvParts_RowEnter(ByVal sender As Object, ByVal e As
> System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvParts.RowEnter
> If dgvParts.Rows(e.RowIndex).IsNewRow Then
> dgvParts.CurrentCell = dgvParts.CurrentRow.Cells(0)
> End If
> End Sub

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Refreshing Linq query to update second DataGridView when position in first DataGridView changes Arved Sandstrom Microsoft C# .NET 1 25th May 2008 04:06 AM
dataGridView.Rows.Count and datagridview.RowCount SePp Microsoft C# .NET 1 15th Jan 2008 10:27 AM
DataGridView (.NET 2.0 Windows Forms) Text wrapping in DataGridView Items Chris Hayes Microsoft Dot NET Framework 1 27th Aug 2006 06:07 PM
Clearing selection in DataGridView when user clicks outside the DataGridView control djyakov@gmail.com Microsoft Dot NET Framework Forms 0 16th Feb 2006 06:38 PM
Refreshing datagridview contents after a failed delete in bound datagridview Bob Microsoft VB .NET 0 5th Jan 2006 06:34 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:42 PM.