We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Get RowIndex out of DataRow

Thread ID:

Created:

Updated:

Platform:

Replies:

58257 Mar 21,2007 08:47 AM Mar 21,2007 03:55 PM Windows Forms 2
loading
Tags: GridControl
Peter Manser
Asked On March 21, 2007 08:47 AM

Hello,

well I'm from Switzerland, so my english isn't very good.


So, I've a problem.

I'm looping through all the Rows in a DataTable to control the values of the cells. If a value isn't correct I want to apport and set the focus on this cell.
Well I allready found the function "


My code looks like that:
(I deleted many things, but you don't have to care about the rest)

---code---
Private Function ValidateRapportPos(ByVal oGrid As Syncfusion.Windows.Forms.grid.GridDataBoundGrid) As Boolean
Dim oRow As DataRow
Dim oDataTable As New DataTable
oDataTable = m_RppStunden

For Each oRow In oDataTable.Rows

If oRow(enColsGrd.Bezeichnung) <= 0 Then
m_sMsg = "error! bla bla bla!"

'Here i want to set the focus to the cell: oRow(enColsGrd.Bezeichnung) oGrid.CurrentCell.MoveTo(, enColsGrd.Bezeichnung)

Return False
End If

Next
---code---



thank you very much for helping me!


regards peter.

Administrator [Syncfusion]
Replied On March 21, 2007 08:51 AM

oh... there's a little mistake, it's quite difficult to write code in here... :)

'Here i want to set the focus to the cell: oRow(enColsGrd.Bezeichnung)
oGrid.CurrentCell.MoveTo(???, enColsGrd.Bezeichnung)

??? = RowIndex, but how can I get it, out of oRow?

Administrator [Syncfusion]
Replied On March 21, 2007 03:55 PM

Hi Peter,

Use the Binder.ListManagerPositionToRowIndex method to find a zero-based position of the data source displayed in the grid to an absolute row index in the grid. You can try the below code snippet to find a rowindex.

---code---
Private Function ValidateRapportPos(ByVal oGrid As Syncfusion.Windows.Forms.grid.GridDataBoundGrid) As Boolean
Dim oRow As DataRow
Dim oDataTable As New DataTable
Dim iPosition As Integer = 0
oDataTable = m_RppStunden

For Each oRow In oDataTable.Rows

If oRow(enColsGrd.Bezeichnung) <= 0 Then
m_sMsg = "error! bla bla bla!"
'Here i want to set the focus to the cell: oRow(enColsGrd.Bezeichnung) oGrid.CurrentCell.MoveTo(, enColsGrd.Bezeichnung)

Dim iRowIndex As Integer = oGrid.Binder.ListManagerPositionToRowIndex(iPosition)
oGrid.CurrentCell.MoveTo( iRowIndex , enColsGrd.Bezeichnung)

Return False
End If
iPosition ++
Next
---code---

Best Regards,
Haneef

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;