That was probably bad title, but I'll illustrate what I'm trying to do. I have a method in a class that I need to call several times. The method returns a List(Of String). I'm just grabbing some information from a database.
VB.NET Code:
Public Function GetTestList() As List(Of String) Dim int As Integer = 0 Dim cso_list As New List(Of String) Dim connection As New Connection() Dim record_set As New Recordset connection.Open("...") record_set.Open("...", connection) With record_set Do While Not .EOF And Not int = 100 int = int + 1 cso_list.Add(CStr(record_set("...").Value)) .MoveNext() Loop End With connection.Close() Return cso_list End Function
You can see in that method that I'm getting the values from the database, adding it to the new list and returning that list.
I then assign that list to a variable in my main class and loop through them.
VB.NET Code:
Dim records As List(Of String) = Me.test.GetTestList For Each str In records 'Do stuff Next
When looping through the items, I'm showing them in the UI. But that's the quick and easy part. The long part is actually gathering the list. So I want to display the value without returning the list.
Is there a way to do this without updating the UI from the method?




Reply With Quote