[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.vb.general.discussion

MSHFlexGrid: Is a RecordSet the only route to a hierarchical dataset?

(Mike Mitchell)

7/8/2011 11:48:00 AM

Everything I've read up so far about the MSHFlexGrid involves an ADO
RecordSet, either directly as DataSource, or via an ADO DataControl
(AdoDC1).

Is there any way of filling the hierarchical flexgrid with Additem so
as to create a hierarchy? That is, with the expand/collapse feature
where you click on the + to expand the view.

I have an array that I'd quite like to show in such a grid. The array
is an array of arrays such that there is a master-detail relationship
from element to element. For example, let Items() be the array, then

Items(0) = "Bread"
Items(0).Ingredients(0) = "Flour"
Items(0).Ingredients(1) = "Salt"
Items(0).Ingredients(2) = "Yeast"

Items(1) = "Cake"
Items(1).Ingredients(0) = "Sultanas"
Items(1).Ingredients(1) = "Sugar"
Items(1).Ingredients(2) = "Cherries"

etc etc

So in my grid I'd see
+Bread
+Cake

and could expand the item into its ingredients.

I suppose I could create a disconnected recordset in code by applying
some kind of SHAPE statement to build it, but usually I add items to a
grid by using AddItem.

MM
3 Answers

ralph

7/9/2011 4:31:00 AM

0

On Fri, 08 Jul 2011 12:48:21 +0100, MM <kylix_is@yahoo.co.uk> wrote:

>Everything I've read up so far about the MSHFlexGrid involves an ADO
>RecordSet, either directly as DataSource, or via an ADO DataControl
>(AdoDC1).
>
>Is there any way of filling the hierarchical flexgrid with Additem so
>as to create a hierarchy? That is, with the expand/collapse feature
>where you click on the + to expand the view.
>
> <snipped>
>
>I suppose I could create a disconnected recordset in code by applying
>some kind of SHAPE statement to build it, but usually I add items to a
>grid by using AddItem.
>
>MM

That would be the way to create an independent (non-database) data
storage for a MSHFlexGrid.

In general terms ... the reason you can't use an "AddItem" type method
is because the control does not have a separate storage for its data,
but rather assumes it will be 'bounded' to a DataSource. It acts as a
Data Consumer.

Creating a disconnected recordset is not as 'over-kill' as it might
first appear. To create your own shaped data storage from scratch that
could be used by the MSHFlexGrid would not be a non-trivial exercise.

-ralph

ralph

7/9/2011 4:36:00 AM

0

On Fri, 08 Jul 2011 23:30:33 -0500, ralph <nt_consulting64@yahoo.net>
wrote:

Lol, double negatived myself. <is that a word?>

>
>Creating a disconnected recordset is not as 'over-kill' as it might
>first appear. To create your own shaped data storage from scratch that
>could be used by the MSHFlexGrid would not be a non-trivial exercise.
>

better make that " ... would not be a trivial exercise."

-ralph

ralph

7/11/2011 4:30:00 PM

0

On Fri, 08 Jul 2011 23:30:33 -0500, ralph <nt_consulting64@yahoo.net>
wrote:

>
>In general terms ... the reason you can't use an "AddItem" type method
>is because the control does not have a separate storage for its data,
>but rather assumes it will be 'bounded' to a DataSource. It acts as a
>Data Consumer.
>

This might be a tad confusing because many controls (inherent and 3rd
party) that do have an "AddItem" method also offer the ability to be
'bounded'. In this case it is an option - the MSHFlexGrid offers no
such option.

-ralph