Cant use a Function to populate a combo box
 
Home My Account Forum Try It! Buy It!
About Contact Us Site Map
StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      


12»»

Cant use a Function to populate a combo boxExpand / Collapse
Author
Message
Posted 08/17/2007 1:44:57 PM


StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: 06/12/2008 10:28:41 AM
Posts: 303, Visits: 434
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?
Post #10920
Posted 08/17/2007 2:58:48 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Today @ 8:47:41 AM
Posts: 4,104, Visits: 4,175
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.
Post #10926
Posted 08/17/2007 3:04:46 PM


StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: 06/12/2008 10:28:41 AM
Posts: 303, Visits: 434
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.
Post #10928
Posted 08/17/2007 4:08:09 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Today @ 8:47:41 AM
Posts: 4,104, Visits: 4,175
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!
Post #10931
Posted 08/17/2007 4:26:41 PM


StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: 06/12/2008 10:28:41 AM
Posts: 303, Visits: 434
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.
Post #10932
Posted 08/17/2007 8:19:56 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Today @ 8:47:41 AM
Posts: 4,104, Visits: 4,175
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!

Post #10938
Posted 08/17/2007 10:49:01 PM


StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: 06/12/2008 10:28:41 AM
Posts: 303, Visits: 434
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.

Post #10939
Posted 08/20/2007 9:44:55 AM


StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: Yesterday @ 3:22:13 PM
Posts: 329, Visits: 1,991
Trent,

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

Post #10944
Posted 08/20/2007 3:28:42 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Toda