Solved

visual basic functions

Posted on 2004-10-12
6
187 Views
Last Modified: 2010-04-17
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.

0
Comment
Question by:Francisco_M
6 Comments
 
LVL 12

Expert Comment

by:farsight
Comment Utility
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.
0
 
LVL 69

Accepted Solution

by:
Éric Moreau earned 60 total points
Comment Utility
On which line do you get the error?

Remove parenthesis or add a CALL statement like this:
myactive_users this_datalist1
call myactive_users(this_datalist1)

Also add the Recordset to these 2 lines:
    Set current_list.DataSource = Adodc1.Recordset
    Set current_list.RowSource = Adodc1.Recordset
0
 

Expert Comment

by:huyntminh
Comment Utility
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.
0
 

Author Comment

by:Francisco_M
Comment Utility
THANKS emoreau,
It worked!
Sorry to reply so late!
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
maxMirror challenge 10 88
Visual xHarbour 1 74
Specific format 21 140
Non-recursive backtracking, using a stack 1 47
I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now