Link to home
Start Free TrialLog in
Avatar of Francisco_M
Francisco_M

asked on

visual basic functions

hi there, I've created a function that should return  results on a datalist object:(here are the codes):
======
Public Function myactive_users(current_list As datalist)
   
    Adodc1.ConnectionString = "DSN=mydsn"
    Adodc1.RecordSource = "select distinct myUsers from myTable  order by Myuser"
    Adodc1.Refresh
   
    current_list.DataField = "myUsers"
    current_list.ListField = "myUsers"
   
    Set current_list.DataSource = Adodc1
    Set current_list.RowSource = Adodc1
   
End Function
=========
Now, when I call this function to populate results on another datalist, the compiler tells me  "error mismach". This is what I am doing: myactive_users(this_datalist1)
Anybody can help on how to do that properly?
I will apreciate ur help.
F.

Avatar of farsight
farsight

I don't fully understand your issue.  But this might get you started ...

[VB.NET]
Public Function myactive_users(current_list As datalist) As ???_What_Type_???

   Return ???_What_Object_Of_The_Given_Type_???    
End Function

In VB6, you'd use:
  myactive_users = ???_What_Object_Of_The_Given_Type_???
instead of the Return statement.
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I agree with emoreau, and remember, your datalist object "this_datalist1" must be initialized before passing it to the function myactive_users.
Hope u sucess.
Avatar of Francisco_M

ASKER

THANKS emoreau,
It worked!
Sorry to reply so late!