listview ( refresh)


Author
Message
Eric Leissler
Eric Leissler
StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)
Group: StrataFrame Users
Posts: 0, Visits: 527
hi,

how can i do ?

in a form, i have a listview and a textbox.

The listview is on a businessobject client

i want in the validated method of the textbox make

If Bo_clients1.Seek("raison_sociale = '" & Me.Tbox2.Text.Trim & "'") = True Then

Me.ListView1.Requery()

 

End If

after the requery, i woud have the listview1 on the current reccord

 

Thanks for your answer

Best regards

Eric

 


Edhy Rijo
E
StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Eric,

If I understand you correctly, you have a textbox and when the user enter a value you want to show that record selected in the listview, right?

If so, you don't have to requery the listview, you have to loop the listview items until you find the correct record, then select it.  Here is some code I use in one of my applications that may be what you are looking for:

 Dim findTextValue As String = txtFindCustomerName.Text.ToUpper
         If String.IsNullOrEmpty(findTextValue) Then
             Exit Sub
         End If
         With Me.lstQBCustomers
             For Each item As StrataListViewItem In .Items
                 If item.SubItems(1).Text.ToUpper.StartsWith(findTextValue) Then
                     item.Selected = True
                     .EnsureVisible(item)
                     Exit Sub
                 End If
             Next
         End With


Keep in mind that in the above code I am using a StrataListView, so the item is cast as StrataLisviewItem, if you are using the standard SF ListView, then I believe it should be cast to a ListViewItem, also I am specifically comparing the Text value of a SubItem(1), in your case you have to make sure which column value in your listview will be used to locate the searched text.  Since you are first locating the record in your Client1 bo via the Seek() method, I would use the Client1 PK, and search the ListViewItem.Tag instead.

Edhy Rijo

Michel Levy
Michel Levy
StrataFrame User (421 reputation)StrataFrame User (421 reputation)StrataFrame User (421 reputation)StrataFrame User (421 reputation)StrataFrame User (421 reputation)StrataFrame User (421 reputation)StrataFrame User (421 reputation)StrataFrame User (421 reputation)StrataFrame User (421 reputation)
Group: StrataFrame Users
Posts: 193, Visits: 9K
Eric,

une variante de la solution d'Edhy Rijo (merci Edhy)
a similar way as the solution provided by Edhy Rijo (Thanks Edhy)



Private Sub txtSaisie_TextChanged(sender As System.Object, e As System.EventArgsHandles txtSaisie.TextChanged
    Dim maSaisie As String = Me.txtSaisie.Text.ToUpper
    Me.lstModePaie.FindItemWithText(maSaisie).Selected = True
    If Not IsNothing(Me.lstModePaie.SelectedItems(0)) Then
        Me.lstModePaie.SelectedItems(0).EnsureVisible()
    End If
End Sub

Edhy Rijo
E
StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Michael,

Thanks for pointing out the FindItemWithText(), I used it before, but after replacing my SF ListView controls with the StrataListView I had to go with the items collection loop since the method FindItemWithText() does not exist in the StrataListView yet Crying

Edhy Rijo

Eric Leissler
Eric Leissler
StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)
Group: StrataFrame Users
Posts: 0, Visits: 527
many thank's Edhy

best regards

Eric
Edhy Rijo
E
StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
You are welcome Eric.  Glad it help out.

Edhy Rijo

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search