Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Flex Grid or better Control? 1

Status
Not open for further replies.

Glowworm27

Programmer
May 30, 2003
587
US
I have an App that I want to use some sort of a Grid.

Basicaly I want to list employees down the left side, and then have 8 columns.

Sunday Thru Saturday and the last Column Totals
In which I want to display Scheduled hours for each employee, for each day of the week. and in the totals column display the total hours for the week.

Now I was starting to use the Micro$oft FlexGrid, and was also looking at True Grid. Which is better/easier/more flexable? to use, or would a different Control be a better solution? Say a ListView Control?

Some features I would like are to be able to Center the text in each cell, change the font in each cell.

thanks in advance
[Cannon]

George Oakes
Goakes@TiresPlus.com = Programmer
George@1-Specialday.com = Mobile DJ
Check out this awsome .Net Resource!
 
The MSFlexGrid can do what you need and it's free.

You can also control the individual cell properties (font, aligmnent, back and fore colour, etc.), add graphics and remove the grid lines (to make it look like a Listview control) along with other things. It can be bound to your data or left unbound. I use the FlexGrid for my grid.

See faq222-3262 for some more information.

To be honest, I have never used the True Grid so I can't comment on whether one is better than the other.

zemp
 
I would go for the Flexgrid every time. Most useage issues have been well covered in the forum, most things on answer in the search pages or other sources, although Tek-Tips being the best source always. Good luck
 
Two ways to align data in a cell.

First is via the formatstring property at design time or runtime. For Example,

Code:
MSFlexgrid1.Formatstring = "<Col1   |^Col2   |>Col3   "

< - aligns the entire colonm to the left
^ - aligns the entire column in the center
> - aligns the entire column to the right.

Second you can set the .CellAlignment property at runtime. The cell properties are not available at design time.

zemp
 
The CellAlignment properties are found on microsofts MSDN site at
Quickly they are ....

Constant Value Description
flexAlignLeftTop 0 The cell content is aligned left, top.
flexAlignLeftCenter 1 Default for strings. The cell content is aligned left, center.
flexAlignLeftBottom 2 The cell content is aligned left, bottom.
flexAlignCenterTop 3 The cell content is aligned center, top.
flexAlignCenterCenter 4 The cell content is aligned center, center.
flexAlignCenterBottom 5 The cell content is aligned center, bottom.
flexAlignRightTop 6 The cell content is aligned right, top.
flexAlignRightCenter 7 Default for numbers. The cell content is aligned right, center.
flexAlignRightBottom 8 The cell content is aligned right, bottom.
flexAlignGeneral 9 The cell content is of general alignment. This is "left, center" for strings and "right, center" for numbers.


Thanks All
[Cannon]

George Oakes
Goakes@TiresPlus.com = Programmer
George@1-Specialday.com = Mobile DJ
Check out this awsome .Net Resource!
 
Hi,
I'm trying tho align an MS FlexGrid with the folowing code but id does nothing. Do I need to add a reference? have i missed something?
Code:
dim j as integer
For j = 1 To 6
    msgRequests.ColAlignment(j) = flexAlignLeftBottom
Next

I've read thread222-807293 and although very informative found no help.

Everybody body is somebodys Nutter.
 

Hi,
Try the following

dim j as integer
For j = 1 To 6
set msgRequests.ColAlignment(j) = flexAlignLeftBottom
Next

Madhivanan
 
Madhi,

Applying "Set" is illegal in your example since it causes attempt to assign a value to the constant.

The statement should work fine without "Set".

vladk
 
Madhi,
vladk's comment are bourne out it doesn't like the Set key word. Just to clarify I'm using the [Blue]MSFlexGrid[/Blue] not the [Blue]MSHFlexGrid[/blue] coud this be the root of the issue?

Everybody body is somebodys Nutter.
 
ClulessChris,

I don't think, that using MSFlexGrid instead of MSHFlexGrid and vs can be an issue here.

vladk
 
Vladk,

I've looked at an older project where I use a similar code
Code:
 MSFlexGrid1.ColAlignment(j) = vbLeftJustify

This works fine in the older project but not in the new. I'm prety mush stumped, thinks I'll scrap this form and start again.

Thanks for your help.

Everybody body is somebodys Nutter.
 
ClulessChris,

I tried your MSFlexGrid1.ColAlignment(j) = vbLeftJustify; it works fine (the same as flexAlignLeftTop; both are 0). It still might be better to use flexAlign... enumeration since there is better choice here.

Thank you

vladk
 
I have used both grids, and I have to say that (used in conjunction with Xarray objects) I much prefer the TrueDBGrid. Being able to write stuff to it is a major advantage, and a lot of things that you would have to write specific code for in a Flex (alternating back colours on rows for example) are automated in TrueDBGrid.

Just my opinion. Nothing wrong with using Flex if it floats your particular boat, and if all you are doing is simply displaying text (ie read only) then you might find it difficult to justify the expense of TrueDBGrid.

mmilan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top