Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. focus on row

focus on row

Scheduled Pinned Locked Moved Database
helpquestionannouncement
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    NikoTanghe
    wrote on last edited by
    #1

    What I want to do: I have a listview, when the user clicks on a row and presses an edit button, a dialog is shown and the user can change the row in the dataset. The dialog contains several databound edit controls. problem: The dialog should focus on the right row. most of the time, this is correct. But sometimes it is not. Not sure why, but it happens when I add, remove rows from the dataset or sort the data. Is this approach correct? what should be the problem? my code: Private Sub btnWICustomerEdit_Click(...) ... Dim key As Integer = getkey() 'create form Dim EditData As frmEditDataActivities = New frmEditDataActivities(...) Dim rowIndex As Integer = **dsCustomers.Tables(0).DefaultView.Find**(Key) If rowIndex = -1 Then Return End If 'focus on the right row EditData.SetFocusRow(rowIndex, dsCustomers) EditData.ShowDialog() 'do update, save changes End Sub 'a member from the dialog class Public Sub SetFocusRow(ByVal rowIndex As Integer, ByRef dsCustomers As dsCustomers) **Dim cm As CurrencyManager cm = CType(Me.BindingContext(dsCustomers, dsCustomers.Tables(0).TableName), CurrencyManager) cm.Position = rowIndex** End Sub

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups