borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2009 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Dictionary Database)Next Topic (SQL PASSWORD) New Topic New Poll Post Reply
AndreaVB Forum : Database : MSHFlexgrid With Bands
Poster Message
~Bean~
Level: VB Guru


Registered: 07-04-2003
Posts: 488

icon MSHFlexgrid With Bands

I am trying to populate a MSHFlexgrid with a recordset.   Even though I could use another control or two to display the same data (a little differently) I would like to use the HFlexgrid. I have tried the two suggested methods of: (1) Use a Data Environment, and (2) Use and ADODC an set it command text to an SQL Shape statement.

The data environment actually worked OK but I really don't want a DE in my project (this one view would be all it would be used for). The ADO control works too but it doesn't set the bands (in other words, it just populates like a datagrid would with no hierarchy... +/-'s)

This brings me to a third option, doing it programmatically, but I have only been able to find a few snippets on this and none of them set the bands either. And MS Help is, well, not helping me...quite simply, I am looking for an example of code that adds a few rows to a MSHFlexgrid, and also demonstrates coding a couple of bands.

tia

~Bean~




[Edited by ~Bean~ on 12-06-2003 at 01:28 PM GMT]

____________________________
Eggheads unite! You have nothing to lose but your yolks.

12-06-2003 at 06:27 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
theVoid0
Level: Guest

icon Re: MSHFlexgrid With Bands

Have you gone through this from MSDN yet?

____________________________
Attached:
DEGuide.zip 28 KB (Downloads: 14)

05-12-2003 at 09:18 AM
| Quote Reply
~Bean~
Level: VB Guru


Registered: 07-04-2003
Posts: 488
icon Re: MSHFlexgrid With Bands

I have, but could not find any helpful examples of programmatically setting the hierarchy. I do not want a DE...

____________________________
Eggheads unite! You have nothing to lose but your yolks.

08-12-2003 at 03:05 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
roula
Level: Guest

icon Re: MSHFlexgrid With Bands

well great now no one else can get benefits from ur reply !

11-02-2004 at 07:23 AM
| Quote Reply
fabulous
Level: VB Guru


Registered: 03-08-2002
Posts: 439
icon Re: MSHFlexgrid With Bands

Hi Bean, I'm not sure I fully understand what you want to do but my guess is that you want to have all the grouping functionality you get in the MSHFlexGrid without the DE.

By bands I am assuming that you mean the different groups. If I am correct here goes:

The structure you get in the MSHFlexGrid is a result of what is known as a hierarchical recordset. This is made up, naturally, of a hierarchy of recordsets. Any set of data that can be represented by a parent/child or master/detail relationship can be defined as a hierarchical recordset.

To get one of these through code without the use of the DataEnvironment you need to do a few things with your connection.

[1]Set your provider to MSDataShape (I believe it can work if you don't change it)
[2]If you have done the above step, then set the Data Provider to whatever you were using before as the provider, e.g. Jet or Sql server

conStr = "Data Source=" & strDBName & "; Provider=MSDataShape; Data Provider=Microsoft.Jet.OLEDB.4.0;"

[3]The command that returns the data you want to place inside your grid should be as follows, (using Biblio as our test database)

Dim sql As String
sql = "SHAPE {SELECT * FROM Publishers} AS cmdPublishers APPEND ({SELECT * FROM Titles} AS cmdTitles RELATE 'PubID' TO 'PubID') AS cmdTitles"
'...create the recordset and open it
'assuming rsDataShape is the recordset that we are building
Set FGrid.Recordset = rsDataShape


That there should give you the hierarchical style grid that you want. Let me know if you want a complete working example. I hope this is what you wanted. Happy coding.

____________________________
My boss is a Jewish Carpenter (Jesus Christ)


Brain Bench Certified VB.NET Developer

11-02-2004 at 09:51 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
~Bean~
Level: VB Guru


Registered: 07-04-2003
Posts: 488
icon Re: MSHFlexgrid With Bands

Sweeeeeeeet!
THANKS!

____________________________
Eggheads unite! You have nothing to lose but your yolks.

13-02-2004 at 08:07 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
AndreaVB Forum : Database : MSHFlexgrid With Bands
Previous Topic (Dictionary Database)Next Topic (SQL PASSWORD) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2009 Andrea Tincaniborder