Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
MmPicker ItemSelected Index Value
Message
De
14/03/2005 14:25:10
 
 
À
14/03/2005 13:29:06
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Versions des environnements
Environment:
VB.NET 1.1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
00995605
Message ID:
00995644
Vues:
17
Worked around my difficulties as follows (but would love any other solutions):
    Private Sub CompanySelectionPicker_ItemSelected _
        (ByVal sender As Object, _
        ByVal e As OakLeaf.MM.Main.Windows.Forms.mmPickerItemSelectedEventArgs) _
        Handles CompanySelectionPicker.ItemSelected

        ' Find the position of the primary key selected in the Picker
        Dim companyIdSelected As Integer = _
            CInt(e.dsSelectedItems.Tables.Item(0).Rows(0).Item("CompanyId"))

        ' The user selected an item from the Picker. 
        ' Locate a row in the grid based on the 
        ' Sort column value(s) supplied in a string. 
        Try
            Dim intRow As Integer
            Dim dv As DataView = _
                Me.oCompany.GetCurrentDataSet.Tables("Companies").DefaultView
            Dim dr As DataRow

            ' Set the Sort prop. with Col(s) to search [REQUIRED].
            dv.Sort = "CompanyId"

            ' Set the index of the found row or -1 if not found
            intRow = dv.Find(companyIdSelected)

            ' Handle row not found or found at index greater than available
            If intRow < 0 Or intRow > dv.Count Then
                MsgBox("Row not found based on the criteria provided.")
            Else

                ' Return the matching row
                dr = dv(intRow).Row

                ' Use the form's BindingContext object to set the position
                Me.BindingContext _
                    (CompanyDataset, CompanyDataset.Tables(0).TableName). _
                    Position = intRow

                ' Update form fields with new value selected
                Me.CompanyFormSetFieldValues()

            End If
        Catch exFE As FormatException
            MsgBox(exFE.Message & " ...Find argument setting. " _
            & vbCrLf & companyIdSelected.ToString)
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
THANKS
Joe Salvatore, Programmer/Analyst - The Stellar Group
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform