Cant use a Function to populate a combo box


Author
Message
Andria Jensen
Andria Jensen
StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)
Group: Forum Members
Posts: 336, Visits: 497
When I setup the PopulationDataSourceSettings on a combo box, I am trying to use a FillAll function which return the count of records in the BO after the fill.  I dont care about the return value when filling the combo, but I still want to use the FillAll function to fill it.  However, it's not available in the Method to Execute dropdown unless it's a Sub.  Is there anything that can be done about this or some reason it is like this that I'm not understanding?
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
The only reason it would not show up is if it is a private method or if you store the assembly in which it resides in the GAC.  In the case of it being in the GAC, close down Visual Studio and come back in and it should then be available...AFTER you have sucessfully built the project in which the BO resides.
Andria Jensen
Andria Jensen
StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)
Group: Forum Members
Posts: 336, Visits: 497
I don't use the GAC for my assemblies, so I don't think that's the issue.  The function was definitely Public, not Private.  That was the first thing I checked.  I built, rebuilt, closed VS and opened it back about 3 or 4 times just to be sure I wasn't crazy.  It never showed up in the dropdown.  Then I just changed it from a Function to a Sub, built my BO library, and presto, it showed up in the dropdown.
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
When it was a Function did it have a return value?  If not that could have prevented it from appearing.  At any rate, glad you got it working! Smile
Andria Jensen
Andria Jensen
StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)
Group: Forum Members
Posts: 336, Visits: 497
Well, it did have a return value as a Function...functions are required to have return values, but in this instance I don't always need to use the return value.  I do have it working as a Sub, but I would really like to be able to use Functions in here as well.  I may have a FillAll that I would like to sometimes use and get back the count which I want to use in a dropdown.  I can't use it there as it is right now.
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
functions are required to have return values

In C# that is true 100% of the time.  It sounds like you have your project setup correctly, but it is actually possible to omit this in VB....and then problems will occur.  The other thing that you can do in VB.NET, which is frustrating, is omit a return statement since by default is has a reference value to itself for backward compatability....wish you could force BOTH of these things to a compiler error no matter what!

Andria Jensen
Andria Jensen
StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)StrataFrame User (422 reputation)
Group: Forum Members
Posts: 336, Visits: 497
Ok, I get what you are saying.  However, I have a return value explicitly set.  My code looks like the following:

Public Function FillAll() as Long
  BO.FillDataTable("SELECT * FROM MyTable")
  Return BO.Count
End Function

Please let me know what I'm missing here.  I'm a little confused after all the back and forth.

Paul Chase
Paul Chase
Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)
Group: Forum Members
Posts: 414, Visits: 2.8K
Trent,

I ran across the same thing recently. The Method to execute dropdown does not show functions only methods.


Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Yeah, after Andria's post I figured something was going on there.  I will look into it.  Thanks.
Paul Chase
Paul Chase
Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)
Group: Forum Members
Posts: 414, Visits: 2.8K
10-4 thanks Smile
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