By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,771 Members | 1,741 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,771 IT Pros & Developers. It's quick & easy.

Data Grid Class & Currency manager

P: n/a
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?
Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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

"Doug Bell" <Po*********@vodaphone.com.au> wrote in message
news:Ob*************@TK2MSFTNGP09.phx.gbl...
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?

Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.