PC Review


Reply
Thread Tools Rate Thread

Data Grid Class & Currency manager

 
 
Doug Bell
Guest
Posts: n/a
 
      15th Aug 2005
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?


 
Reply With Quote
 
 
 
 
Doug Bell
Guest
Posts: n/a
 
      15th Aug 2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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?
>
>



 
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
how to bind Data to Grid view with custom data class. =?Utf-8?B?dmluZWV0YmF0dGE=?= Microsoft ADO .NET 0 16th Oct 2006 07:06 AM
Currency Manager with Grid and Form Views C Glenn Microsoft C# .NET 2 14th Dec 2005 01:11 AM
adding grid to working currency manager disables addnew =?Utf-8?B?cG9seW5vbWlhbDVk?= Microsoft ADO .NET 6 23rd Apr 2004 02:31 PM
adding grid to working currency manager disables addnew =?Utf-8?B?cG9seW5vbWlhbDVk?= Microsoft Dot NET Framework 1 18th Apr 2004 03:56 PM
exception during sorting data in a data grid in the constructor of the System.Data.Index class Frank Microsoft Dot NET Framework 0 30th Sep 2003 02:59 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:30 AM.