By Andria Jensen - 8/17/2007
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?
|
By Trent L. Taylor - 8/17/2007
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.
|
By Andria Jensen - 8/17/2007
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.
|
By Trent L. Taylor - 8/17/2007
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!
|
By Andria Jensen - 8/17/2007
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.
|
By Trent L. Taylor - 8/17/2007
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!
|
By Andria Jensen - 8/17/2007
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.
|
By Paul Chase - 8/20/2007
Trent,I ran across the same thing recently. The Method to execute dropdown does not show functions only methods.
|
By Trent L. Taylor - 8/20/2007
Yeah, after Andria's post I figured something was going on there. I will look into it. Thanks.
|
By Paul Chase - 8/20/2007
10-4 thanks
|
By Andria Jensen - 9/17/2007
Any update on this? It's becoming a little more of a problem. I have several FillAll Functions in my code which are used in the code to fill and retrieve a count, but used elsewhere to populate a combo. I can't use the same function in both places right now, since I have to use a Sub instead of a Function for filling combos.
|
By Trent L. Taylor - 9/18/2007
We will add it to the list to take a look at. Thanks.
|
By Andria Jensen - 12/20/2007
Has this been looked at or fixed yet? Please let me know something. I have lots of Fill methods which I changed to functions in my code which return back a count. This is starting to cause a lot of random errors in my code since I may have previously used that method to fill a combo, and changing to a function basically has broken a lot of my populated combos...giving me run-time errors when it's most inconvenient of course.Also, any idea when we might have a new release?
|
By Bill Cunnien - 12/20/2007
Have you considered using a property to reflect your count? I am a bit rusty on VB (sorry), so here is a C# snippet:private int mCount = 0; public int CurrentCount { get { return mCount; } } public void FillAll() { this.FillDataTable("SELECT * FROM MyTable"); mCount = this.Count; } For the count, just grab what's in the CurrentCount property of the BO. Would that work?
Bill
|
By Bill Cunnien - 12/20/2007
I ran this through my test app, and it seems to work. My assumption is that you want the full count regardless of any subsequent browse dialog results. This should work...as long as the FillAll() method is run initially. You may want to consider setting the entire TotalCount property up without the need for the FillAll() method. In other words keep them separate (although, there is some overlapping code there).
|
By Andria Jensen - 12/20/2007
Business objects have a Count property on them already which does exactly what you describe. My fill functions actually just return Me.Count.The reason I like having them as functions returning a count is so I can do something like this: If BO.FillAll() > 0 Then 'Loop through the BO and do some processing End If Otherwise it would be: BO.FillAll If BO.Count > 0 Then 'Loop through the BO and do some processing End If Granted, this isn't that much of a difference code wise. However, I've already replaced probably 100 or more of the second type of call with something like the first, and changed the corresponding sub to a function returning the count. It just makes for easier coding on my part if I do it the first way. I basically don't want to waste a day reversing what I did when it should just be fixed in the framework to allow function on PopulationDataSourceSettings.
|
By Bill Cunnien - 12/20/2007
Seems like a simple enough correction within the framework; however, that may get a bit messy reflecting all of the functions and methods in the hierarchy. I hope you can get to a resolution soon.Take care, Bill
|
By Trent L. Taylor - 12/21/2007
Also, any idea when we might have a new release? We have already decided that we will reflect the functions as well in the next update. As for an exact date on the new release, I cannot give you one. We had initially hoped to get one out before Christmas, but we have added a phenominal amount of enhancements including VS 2008 support, so we have been slow to release until we have gone through a thorough QA cycle. So it will probably be January sometime that we publish the new update.
|
By Andria Jensen - 12/21/2007
Great, thanks Trent. All I wanted was an approximate time frame, so that works for me. Thanks for getting the fix in there too. Have a good Christmas! Don't work the whole time.
|
By Trent L. Taylor - 12/21/2007
Merry Christmas to you as well
|