473,832 Members | 2,107 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataGridView RowEnter not firing...

Using VS2005, VB.NET,
I have a windows app with a DataGridView (lets call it DGV). At some
point in the life of my app I want to clear the selection of the
currently selected row (Multiselect=fa lse) from DGV - to do that I
tried this:
DGV.ClearSelect ion()

Cosmetically this appears to work but it appears that the DGV still
stores the index value of the selected row. If the 1st row I click on
after executing ClearSelection( ) is the row that was previously
selected then the RowEnter event is NOT triggered - clicking on any
other row than the previously selected row DOES trigger the RowEnter
event.

Is this a bug and/or is there some (other) way for me to clear the
selection of current row from a DGV?

Any help would be appreciated...
Jan 11 '08 #1
6 4424
If you have a datatable underlying the datagridview then you need to
manipulate the row in the underlying datatable

"hzgt9b" wrote:
Using VS2005, VB.NET,
I have a windows app with a DataGridView (lets call it DGV). At some
point in the life of my app I want to clear the selection of the
currently selected row (Multiselect=fa lse) from DGV - to do that I
tried this:
DGV.ClearSelect ion()

Cosmetically this appears to work but it appears that the DGV still
stores the index value of the selected row. If the 1st row I click on
after executing ClearSelection( ) is the row that was previously
selected then the RowEnter event is NOT triggered - clicking on any
other row than the previously selected row DOES trigger the RowEnter
event.

Is this a bug and/or is there some (other) way for me to clear the
selection of current row from a DGV?

Any help would be appreciated...
Jan 12 '08 #2
On Jan 11, 7:34*pm, Rich <R...@discussio ns.microsoft.co mwrote:
If you have a datatable underlying the datagridview then you need to
manipulate the row in the underlying datatable

"hzgt9b" wrote:
Using VS2005, VB.NET,
I have a windows app with a DataGridView (lets call it DGV). At some
point in the life of my app I want to clear the selection of the
currently selected row (Multiselect=fa lse) from DGV - to do that I
tried this:
* * *DGV.ClearSelec tion()
Cosmetically this appears to work but it appears that the DGV still
stores the index value of the selected row. If the 1st row I click on
after executing ClearSelection( ) is the row that was previously
selected then the RowEnter event is NOT triggered - clicking on any
other row than the previously selected row DOES trigger the RowEnter
event.
Is this a bug and/or is there some (other) way for me to clear the
selection of current row from a DGV?
Any help would be appreciated...- Hide quoted text -

- Show quoted text -
My DataGridView's DataSource is an in memory DataTable. Regardless it
is the DataGridView control that is not responding to a click on a row
that was selected just prior to calling the DataGridView's
ClearSelection( ) method - it seems that this would be independent of
any underlying data....
Jan 12 '08 #3
On Jan 11, 7:34*pm, Rich <R...@discussio ns.microsoft.co mwrote:
If you have a datatable underlying the datagridview then you need to
manipulate the row in the underlying datatable

"hzgt9b" wrote:
Using VS2005, VB.NET,
I have a windows app with a DataGridView (lets call it DGV). At some
point in the life of my app I want to clear the selection of the
currently selected row (Multiselect=fa lse) from DGV - to do that I
tried this:
* * *DGV.ClearSelec tion()
Cosmetically this appears to work but it appears that the DGV still
stores the index value of the selected row. If the 1st row I click on
after executing ClearSelection( ) is the row that was previously
selected then the RowEnter event is NOT triggered - clicking on any
other row than the previously selected row DOES trigger the RowEnter
event.
Is this a bug and/or is there some (other) way for me to clear the
selection of current row from a DGV?
Any help would be appreciated...- Hide quoted text -

- Show quoted text -
Rich,
I mis-read your message - please ignore my previous response.

Ok, so I changed the code to be this:

Me.dgvCases.Cur rentRow.Selecte d = False
Me.dgvCases.Cle arSelection()

But the problem persists. After this code runs - no rows in the DGV
are highlighted but the DGV's record selector (little triange) still
points to the previously selected row & I get the same result as
before.

Is there another setting in the "row in the underlying datatable" that
I need to manipulate?
Jan 12 '08 #4
On Jan 12, 11:22*am, hzgt9b <celof...@gmail .comwrote:
On Jan 11, 7:34*pm, Rich <R...@discussio ns.microsoft.co mwrote:


If you have a datatable underlying the datagridview then you need to
manipulate the row in the underlying datatable
"hzgt9b" wrote:
Using VS2005, VB.NET,
I have a windows app with a DataGridView (lets call it DGV). At some
point in the life of my app I want to clear the selection of the
currently selected row (Multiselect=fa lse) from DGV - to do that I
tried this:
* * *DGV.ClearSelec tion()
Cosmetically this appears to work but it appears that the DGV still
stores the index value of the selected row. If the 1st row I click on
after executing ClearSelection( ) is the row that was previously
selected then the RowEnter event is NOT triggered - clicking on any
other row than the previously selected row DOES trigger the RowEnter
event.
Is this a bug and/or is there some (other) way for me to clear the
selection of current row from a DGV?
Any help would be appreciated...- Hide quoted text -
- Show quoted text -

Rich,
I mis-read your message - please ignore my previous response.

Ok, so I changed the code to be this:

* * * * * * Me.dgvCases.Cur rentRow.Selecte d = False
* * * * * * Me.dgvCases.Cle arSelection()

But the problem persists. After this code runs - no rows in the DGV
are highlighted but the DGV's record selector (little triange) still
points to the previously selected row & I get the same result as
before.

Is there another setting in the "row in the underlying datatable" that
I need to manipulate?- Hide quoted text -

- Show quoted text -
I finally figured this out... instead of setting the CurrentRow to not
be selected, I set CurrentCell=Not hing to get the behavior I was
looking for. I no longer needed to call ClearSelection( ) call. Here's
the code that worked for me:

Me.dgvCases.Cur rentCell = Nothing

Thanks to those that responded.
Jan 13 '08 #5
On Sat, 12 Jan 2008 17:13:13 -0800 (PST), hzgt9b <ce******@gmail .com>
wrote:
>On Jan 12, 11:22*am, hzgt9b <celof...@gmail .comwrote:
>On Jan 11, 7:34*pm, Rich <R...@discussio ns.microsoft.co mwrote:


If you have a datatable underlying the datagridview then you need to
manipulate the row in the underlying datatable
"hzgt9b" wrote:
Using VS2005, VB.NET,
I have a windows app with a DataGridView (lets call it DGV). At some
point in the life of my app I want to clear the selection of the
currently selected row (Multiselect=fa lse) from DGV - to do that I
tried this:
* * *DGV.ClearSelec tion()
Cosmetically this appears to work but it appears that the DGV still
stores the index value of the selected row. If the 1st row I click on
after executing ClearSelection( ) is the row that was previously
selected then the RowEnter event is NOT triggered - clicking on any
other row than the previously selected row DOES trigger the RowEnter
event.
Is this a bug and/or is there some (other) way for me to clear the
selection of current row from a DGV?
Any help would be appreciated...- Hide quoted text -
- Show quoted text -

Rich,
I mis-read your message - please ignore my previous response.

Ok, so I changed the code to be this:

* * * * * * Me.dgvCases.Cur rentRow.Selecte d = False
* * * * * * Me.dgvCases.Cle arSelection()

But the problem persists. After this code runs - no rows in the DGV
are highlighted but the DGV's record selector (little triange) still
points to the previously selected row & I get the same result as
before.

Is there another setting in the "row in the underlying datatable" that
I need to manipulate?- Hide quoted text -

- Show quoted text -

I finally figured this out... instead of setting the CurrentRow to not
be selected, I set CurrentCell=Not hing to get the behavior I was
looking for. I no longer needed to call ClearSelection( ) call. Here's
the code that worked for me:

Me.dgvCases.Cur rentCell = Nothing

Thanks to those that responded.
I have been struggling with this same issue, and have discovered that
setting CurrentCell = Nothing does not prevent a row from being
selected if it is done before the first Paint event. It appears that
the DataGridView selects the first row when it is first painted.
Jan 13 '08 #6
On Jan 13, 1:48*am, Jack Jackson <jjack...@cinno vations.netwrot e:
On Sat, 12 Jan 2008 17:13:13 -0800 (PST), hzgt9b <celof...@gmail .com>
wrote:


On Jan 12, 11:22*am, hzgt9b <celof...@gmail .comwrote:
On Jan 11, 7:34*pm, Rich <R...@discussio ns.microsoft.co mwrote:
If you have a datatable underlying the datagridview then you need to
manipulate the row in the underlying datatable
"hzgt9b" wrote:
Using VS2005, VB.NET,
I have a windows app with a DataGridView (lets call it DGV). At some
point in the life of my app I want to clear the selection of the
currently selected row (Multiselect=fa lse) from DGV - to do that I
tried this:
* * *DGV.ClearSelec tion()
Cosmetically this appears to work but it appears that the DGV still
stores the index value of the selected row. If the 1st row I click on
after executing ClearSelection( ) is the row that was previously
selected then the RowEnter event is NOT triggered - clicking on any
other row than the previously selected row DOES trigger the RowEnter
event.
Is this a bug and/or is there some (other) way for me to clear the
selection of current row from a DGV?
Any help would be appreciated...- Hide quoted text -
- Show quoted text -
Rich,
I mis-read your message - please ignore my previous response.
Ok, so I changed the code to be this:
* * * * * * Me.dgvCases.Cur rentRow.Selecte d = False
* * * * * * Me.dgvCases.Cle arSelection()
But the problem persists. After this code runs - no rows in the DGV
are highlighted but the DGV's record selector (little triange) still
points to the previously selected row & I get the same result as
before.
Is there another setting in the "row in the underlying datatable" that
I need to manipulate?- Hide quoted text -
- Show quoted text -
I finally figured this out... instead of setting the CurrentRow to not
be selected, I set CurrentCell=Not hing to get the behavior I was
looking for. I no longer needed to call ClearSelection( ) call. Here's
the code that worked for me:
* * * * * *Me.dgvCases.Cu rrentCell = Nothing
Thanks to those that responded.

I have been struggling with this same issue, and have discovered that
setting CurrentCell = Nothing does not prevent a row from being
selected if it is done before the first Paint event. *It appears that
the DataGridView selects the first row when it is first painted.- Hide quoted text -

- Show quoted text -
Yea, I've read similar things. Fortunately for me, my call to set the
DataGridView's CurrentCell = Nothing is long after the control is
initially painted so I did not run into this issue. Best of luck and
thanks again for your help.
Jan 15 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
6326
by: hazz | last post by:
I am simply trying to obtain the value of a specific cell ( a CustomerID in a particular row.) in a DataGridView. How (or can I ) do this using the RowEnter event? The datagrid is bound to a datasource obtained via BindingList<Customer> GetCustomers();
0
1306
by: Paul Cheetham | last post by:
Hi, I have a DataGridView Control, which I am databinding at run-time. When the data is loaded, the first row in the grid gets selected, and the selectionChanged event gets fired. I want the datagrid to have nothing selected by default, until a row is selected by the user. Is this possible?
0
2948
by: Brian Tkatch | last post by:
DataGridView's RowEnter event has e.RowIndex as the current (new) row. Yet CurrentCellAddress.Y is the old value. This can be easily seen in a new form. Create a new windows application, add a DataGridView, in the code add: Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim table As New DataTable table.Columns.Add()
0
1252
by: CSharpie1000 | last post by:
I am sorry for the broadness of this question, but I litterally can't get anywhere with this. I have a dataGridView that loads data from an Access 2007 Database. This works fine. I would like to, when I double click on a dataGridView row though, have a second form open with the information displayed in textboxes, etc. Not all of my data is in the dataGridView. From what I can gather, I would use the dataGridView RowEnter event for this,...
12
13662
by: cj | last post by:
When viewing a datatable in a datagridview one of the columns in it is a "note" field which can be quite long. I would like to have the note field of the currently selected row of the datagrid display in a textbox below the datgridview. I currently have it fixed so if you click on a row the note field from that row is put in the textbox. I'd like this to be automatic as they move through rows. Also the note field is one of two fields...
3
2524
nirmalsingh
by: nirmalsingh | last post by:
hai all, i have added a dropdownlist control inside a datagridview by datagridview.controls.add method, now i want fire the event of dropdownlist, but when i try it, event of datagridview is firing. how to handle event of ddlist? thanks in advance, with cheers -Nirmal.
5
2861
by: cj | last post by:
In VB 2008 how do I link the datagridview to a dataset? mydataadapter.fill(myds, "test") datagridview1.???????? When I was using 2005 I used the datagrid and it was done like: mydataadapter.fill(myds, "test") datagrid1.DataGrid1.SetDataBinding(ds, tableName)
1
3766
by: Aegixx | last post by:
Ok, extremely wierd situation here: (I'll post the code below, after the explanation) I've got a Windows application (.NET 3.5) that has a single Form with a DataGridView embedded. The user presses a button to do a SQL query (fill a DataSet). Before firing the query, I disable the grid/buttons and turn on UseWaitCursor. After it completes, I re-enable the grid/ buttons, refresh the dataset, then turn off the UseWaitCursor. If I...
6
8811
by: Simon Harvey | last post by:
Hi all, I'm really hoping someone can help me with this as it's causing me some serious problems. I have a Windows Forms application using the gridview control. When the user selects a row, the SelectionChanged event fires and I load some more data that's particular to that row. The problem I'm having is that the SelectionChanged event is going way
0
9795
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10781
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10499
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10541
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10212
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9320
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7753
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5789
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4421
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.