Data Grid Class & Currency manager

D

Doug Bell

Hi,
Hi had a DataGrid on a form and was using the CurrentCellChanged Event to
determine the selected row:
Private Sub grdSelOrd_CurrentCellChanged(ByVal sender As System.Object, _

ByVal e As System.EventArgs)

dacGetDataGridRow()

Dim intRow As Integer = CType(Me.BindingContext(grdSelOrd.DataSource), _

CurrencyManager).Position

..............

End Sub

This worked fine but I needed to prevent some columns from sorting the Data
Grid so I created a new class "CustomDGrid" and used the event
Protected Overrides Sub OnMouseDown(ByVal e As
System.Windows.Forms.MouseEventArgs)

to compare the column against a passed parameter testing columns to sort.

This also worked fine along with event handlers:

With grdSelOrd

..Top = 104

..Left = 16

..Height = 500

..Width = 911

..Anchor = AnchorStyles.Top Or AnchorStyles.Bottom Or AnchorStyles.Left Or
AnchorStyles.Right

..Name = "grdSelOrd"

..TabIndex = 0

..SortCols = "0,1,2,6"

End With

Controls.Add(grdSelOrd)

' Associate an event handler with an event.

AddHandler grdSelOrd.CurrentCellChanged, AddressOf
grdSelOrd_CurrentCellChanged

AddHandler grdSelOrd.DoubleClick, AddressOf grdSelOrd_DoubleClick

AddHandler grdSelOrd.Click, AddressOf grdSelOrd_Click

But I now can not get the code I used to test for the selected row to work.

Could someone explain to me what I need to get the currency manager
reporting the current row back in the Form's class?
 
D

Doug Bell

Solved this,
It wasn't a Currency manager Issue but poor debugging, Clicking on a cell
was being treated as if it was a "NoSort" Column.

Sorry!
Doug
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top