MSFlexgrid Design at Design Time?
Author |
Message |
Chi-Ho La #1 / 8
|
 MSFlexgrid Design at Design Time?
Hey there I'm trying to create a simple grid and fill it with data on a button click. Problem is, I would like to set the grid headers, widths etc. at design time, and can't seem to find how to do it. I know I can do it at run time via code, but that seems clumsy. I've played with the DataGrid, which does allow formatting at design time, but since I am not binding it to data, I can't use it. Any help greatly appreciated. Chi
|
Thu, 29 Jul 2004 00:04:07 GMT |
|
 |
Rocky Clar #2 / 8
|
 MSFlexgrid Design at Design Time?
Look at the FormatString property. It can be set at design time or in code at run time.
Quote: > Hey there > I'm trying to create a simple grid and fill it with data on a button > click. > Problem is, I would like to set the grid headers, widths etc. at > design time, and can't seem to find how to do it. > I know I can do it at run time via code, but that seems clumsy. I've > played with the DataGrid, which does allow formatting at design time, > but since I am not binding it to data, I can't use it. > Any help greatly appreciated. > Chi
|
Thu, 29 Jul 2004 05:46:20 GMT |
|
 |
Chi-Ho La #3 / 8
|
 MSFlexgrid Design at Design Time?
Geez I don't believe it! It was right there in front of me all along! I've actually worked around it with the DataGrid with a temporary table - works quite well, but has more database access than I want. Will look into this - thanks :-) Chi
Quote: >Look at the FormatString property. It can be set at design time or in code >at run time.
>> Hey there >> I'm trying to create a simple grid and fill it with data on a button >> click. >> Problem is, I would like to set the grid headers, widths etc. at >> design time, and can't seem to find how to do it. >> I know I can do it at run time via code, but that seems clumsy. I've >> played with the DataGrid, which does allow formatting at design time, >> but since I am not binding it to data, I can't use it. >> Any help greatly appreciated. >> Chi
|
Thu, 29 Jul 2004 06:55:10 GMT |
|
 |
Charanjeev Sing #4 / 8
|
 MSFlexgrid Design at Design Time?
I had been hunting for this - actually I just posted a query which is quite different - but the solution lies in this thread. Thx. By the way I am Charanjeev Singh from Mumbai, India and I have started participating only recently. Thx Charanjeev Singh
Quote: > Geez I don't believe it! It was right there in front of me all along! > I've actually worked around it with the DataGrid with a temporary > table - works quite well, but has more database access than I want. > Will look into this - thanks :-) > Chi
> >Look at the FormatString property. It can be set at design time or in code > >at run time.
> >> Hey there > >> I'm trying to create a simple grid and fill it with data on a button > >> click. > >> Problem is, I would like to set the grid headers, widths etc. at > >> design time, and can't seem to find how to do it. > >> I know I can do it at run time via code, but that seems clumsy. I've > >> played with the DataGrid, which does allow formatting at design time, > >> but since I am not binding it to data, I can't use it. > >> Any help greatly appreciated. > >> Chi
|
Thu, 29 Jul 2004 07:56:37 GMT |
|
 |
Charanjeev Sing #5 / 8
|
 MSFlexgrid Design at Design Time?
The FormatString does work even with the FlexGrid but what do I do in a case where the actual text in the cell is quite long and yet I want the cell width to be less than the total width of the string, I want it to wrap into two lines, but column width should be lesser than len(solumn header)??
Quote: > Look at the FormatString property. It can be set at design time or in code > at run time.
> > Hey there > > I'm trying to create a simple grid and fill it with data on a button > > click. > > Problem is, I would like to set the grid headers, widths etc. at > > design time, and can't seem to find how to do it. > > I know I can do it at run time via code, but that seems clumsy. I've > > played with the DataGrid, which does allow formatting at design time, > > but since I am not binding it to data, I can't use it. > > Any help greatly appreciated. > > Chi
|
Thu, 29 Jul 2004 08:03:22 GMT |
|
 |
Charanjeev Sing #6 / 8
|
 MSFlexgrid Design at Design Time?
Will the use of FormatString also affect the remaining rows of the grid interms of cell alignment or just row 0? What if I need to use 2 fixed rows for column headings something like this... Sr. Product Description Unit . . . . .. No. (1) (2) . . . . .. Charanjeev Singh
Quote: > Look at the FormatString property. It can be set at design time or in code > at run time.
> > Hey there > > I'm trying to create a simple grid and fill it with data on a button > > click. > > Problem is, I would like to set the grid headers, widths etc. at > > design time, and can't seem to find how to do it. > > I know I can do it at run time via code, but that seems clumsy. I've > > played with the DataGrid, which does allow formatting at design time, > > but since I am not binding it to data, I can't use it. > > Any help greatly appreciated. > > Chi
|
Thu, 29 Jul 2004 08:07:58 GMT |
|
 |
Rocky Clar #7 / 8
|
 MSFlexgrid Design at Design Time?
If you want to wrap the contents of cells, then you need to set WordWrap=True and you'll need to increase the RowHeight to show the wrapped text. The FormatString property will set the width of each column to the width of the column header text, including space characters. If you want the header to wrap, you can do it in code, like this. Private Sub Form_Load() With MSFlexGrid1 .Rows = 3 .Cols = 2 .FixedRows = 2 .FixedCols = 0 'Notice only the first line of text 'is entered into the FormatString. .FormatString = "^ This is a very Long |^ Another very Long " 'Turn on WordWrap .WordWrap = True 'Increase the RowHeight to two lines .RowHeight(0) = .RowHeight(0) * 2 'Change to the actual header text .TextMatrix(0, 0) = "This is a very Long Column Header" .TextMatrix(0, 1) = "Another very Long Column Header" 'Add the second row of column headers .TextMatrix(1, 0) = "Column 1" .TextMatrix(1, 1) = "Column 2" End With End Sub HTH, Rocky
Quote: > The FormatString does work even with the FlexGrid but what do I do in a case > where the actual text in the cell is quite long and yet I want the cell > width to be less than the total width of the string, I want it to wrap into > two lines, but column width should be lesser than len(solumn header)??
> > Look at the FormatString property. It can be set at design time or in code > > at run time.
> > > Hey there > > > I'm trying to create a simple grid and fill it with data on a button > > > click. > > > Problem is, I would like to set the grid headers, widths etc. at > > > design time, and can't seem to find how to do it. > > > I know I can do it at run time via code, but that seems clumsy. I've > > > played with the DataGrid, which does allow formatting at design time, > > > but since I am not binding it to data, I can't use it. > > > Any help greatly appreciated. > > > Chi
|
Thu, 29 Jul 2004 20:33:38 GMT |
|
 |
Rocky Clar #8 / 8
|
 MSFlexgrid Design at Design Time?
Yes, the FormatString also sets the alignment for the data rows. The best way to handle this is to set the alignment in the FormatString to the data alignment, and then re-adjust the header alignment, like this: Private Sub Form_Load() With MSFlexGrid1 .Rows = 3 .FixedRows = 2 .FixedCols = 0 'Notice only the first line of text is entered into 'the FormatString. Alignment is set for data rows. .FormatString = "< This is a very Long |> Another very Long " 'Turn on WordWrap .WordWrap = True 'Increase the RowHeight to two lines .RowHeight(0) = .RowHeight(0) * 2 'Change to the actual header text .TextMatrix(0, 0) = "This is a very Long Column Header" .TextMatrix(0, 1) = "Another very Long Column Header" 'Add the second row of column headers .TextMatrix(1, 0) = "Column 1" .TextMatrix(1, 1) = "Column 2" 'Center the Headers, using their CellAlignment .Row = 0 .Col = 0 .CellAlignment = flexAlignCenterCenter .Col = 1 .CellAlignment = flexAlignCenterCenter .Row = 1 .Col = 0 .CellAlignment = flexAlignCenterCenter .Col = 1 .CellAlignment = flexAlignCenterCenter 'Add some data to show data alignment .TextMatrix(2, 0) = "Left Aligned" .TextMatrix(2, 1) = "Right Aligned" 'Move the selection off of the header rows .Row = 2 .Col = 0 End With End Sub HTH, Rocky
Quote: > Will the use of FormatString also affect the remaining rows of the grid > interms of cell alignment or just row 0? > What if I need to use 2 fixed rows for column headings something like > this... > Sr. Product Description Unit . . . . .. > No. (1) (2) . . . . .. > Charanjeev Singh
> > Look at the FormatString property. It can be set at design time or in code > > at run time.
> > > Hey there > > > I'm trying to create a simple grid and fill it with data on a button > > > click. > > > Problem is, I would like to set the grid headers, widths etc. at > > > design time, and can't seem to find how to do it. > > > I know I can do it at run time via code, but that seems clumsy. I've > > > played with the DataGrid, which does allow formatting at design time, > > > but since I am not binding it to data, I can't use it. > > > Any help greatly appreciated. > > > Chi
|
Thu, 29 Jul 2004 20:43:25 GMT |
|
|
1. Assign a treeview at design run time to other at design time
2. How to design GridCtrl at design time
3. project design software , compare website design software , web developers , website design software review , nof shop , software quality , nof 7.5 , bestellen preisvergleich , web site design , custom web design ,
4. web service and updating web reference with vb.net design time vs run time
5. getting run-time behavior of a contained control in a user control at design time
6. web service and updating web reference with vb.net design time vs run time
7. Design time vs Run time
8. Run Time vs Design Time - No Current Record
9. MsgBox pauses App at Design time but not run time
10. Design Time vs Run Time
11. design-time functionality at run-time
12. Saving properties of ActiveX control from design time to run time
|
|
|