Results 1 to 21 of 21

Thread: [RESOLVED] Align Centre in MSHFlexgrid

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2006
    Location
    London, UK
    Posts
    817

    Resolved [RESOLVED] Align Centre in MSHFlexgrid

    Can someone help me out here?

    Why is it that even though I have defined a column to align to centre, the numerical values in the column correctly align but a column header (which is text) still aligns to left. Below is the code that I'm using.

    VB Code:
    1. x=10
    2. MSHFlexgrd.ColAlignment(1) = flexAlignCenterCenter
    3. MSHFlexgrd.TextMatrix(0, 1) = "Column Header"
    4. MSHFlexgrd.TextMatrix(2, 1) = x

  2. #2
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Align Centre in MSHFlexgrid

    but a column header (which is text) still aligns to left.
    For the header you need to use

    VB Code:
    1. MSHFlexGrd.ColAlignmentHeader(1) = 4
    2. 'or
    3. MSHFlexGrd.ColAlignmentHeader(1) = flexAlignCenterCenter

    Hope this helps...
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2006
    Location
    London, UK
    Posts
    817

    Re: Align Centre in MSHFlexgrid

    Koolsid,

    Didn't realise that but for some reason it's still not working???

  4. #4
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Align Centre in MSHFlexgrid

    both the codes?
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2006
    Location
    London, UK
    Posts
    817

    Re: Align Centre in MSHFlexgrid

    Yea,

    Tried 1, 2, 3, 4 & 5 and none of them did anything to the alignment.

    There is .ColHeader and .ColHeaderCaption which I haven't used yet
    at the moment I have just used the .TextMatrix(0,i) to enter the Column header text but not sure what the difference would be.
    Last edited by sgrya1; Dec 29th, 2006 at 06:43 PM.

  6. #6
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Align Centre in MSHFlexgrid

    Maybe it's my mistake

    the syntax is

    http://msdn.microsoft.com/library/de...ntProperty.asp

    what is the band number? try it with bandnumber.

    Hope this finally helps

    ps: your other thread regarding Wheelmouse scroll MDI application child forms doesn't give you that error anymore... http://vbforums.com/showthread.php?t=444999
    Last edited by Siddharth Rout; Dec 29th, 2006 at 06:49 PM.
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2006
    Location
    London, UK
    Posts
    817

    Re: Align Centre in MSHFlexgrid

    Can't seem to work out what the band number is. Row number = 0 doesn't seem to work.
    ie. MSHFlexgrid.ColAlignmentHeader(0, 1) = flexAlignCenterCenter

  8. #8
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Align Centre in MSHFlexgrid

    Alignment works just fine in the "regular" MsFlexGrid so if you don't Hierarchical grid then switch to MsFlexGrid instead.
    And you only need to set ColAlignment - it doesn't have ColAlignmentHeader:

    MSHFlexgrd.ColAlignment(1) = flexAlignCenterCenter

  9. #9
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Align Centre in MSHFlexgrid

    Alignment works just fine in the "regular" MsFlexGrid so if you don't Hierarchical grid then switch to MsFlexGrid instead.
    And you only need to set ColAlignment - it doesn't have ColAlignmentHeader:

    MSHFlexgrd.ColAlignment(1) = flexAlignCenterCenter
    Hmmm... Hi Check this out ...

    @sgrya1: I might be wrong (just a thought)... do the string in the header have any leading/trailing spaces?

    I am sure that it has to do something with the bandnumber...will search msdn for some info and get back...
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  10. #10

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2006
    Location
    London, UK
    Posts
    817

    Re: Align Centre in MSHFlexgrid

    Koolsid,
    Thanks, There are no leading or trailing spaces. Your last link linked to the same location as the one before it.

    Rhinobull,
    I have to use the MSHFlexgrid as I found a while back that there were printing problems with the "regular" MsFlexGrid. For some reason it printed out as a solid black box.

    This is strange,
    Rather than:
    MSHFlexgrd.TextMatrix(0, 1) = "Column Header" (Which Aligns Left)

    x=10
    MSHFlexgrd.TextMatrix(2, 1) = x (Aligns Right while the rest of the column is still centre)
    So it's definately something to do with the .colheader

    MSHFlexgrd.TextMatrix(0, 1) = x

  11. #11
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Align Centre in MSHFlexgrid

    Hi

    Here is an interesting 'Read'

    http://www.expressnewsindia.com/c4/ex1/C1005.html
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  12. #12

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2006
    Location
    London, UK
    Posts
    817

    Re: Align Centre in MSHFlexgrid

    Thanks for the link koolsid.

    "Unfortunately, while the control works like a charm in this respect, in other areas it's rather clunky. For instance, when it comes to applying data formats to entire grid columns, this control falls short."

    Read the rest but still no joy.

    That explains that the band is the row number though.

    \par \tab For I = 0 To .Bands - 1
    \par \tab\tab For x = 0 To .Cols(I) - 1
    \par \tab\tab\tab header = .ColHeaderCaption(I, x)

  13. #13
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Align Centre in MSHFlexgrid

    Quote Originally Posted by sgrya1
    ... I found a while back that there were printing problems with the "regular" MsFlexGrid. For some reason it printed out as a solid black box...
    I am clueless as to what that might be ... It's the first time I've heard that. How did you "print" your grid?

  14. #14
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Align Centre in MSHFlexgrid

    Guess what?????

    it works....

    uploading the project files in few minutes...
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  15. #15
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Align Centre in MSHFlexgrid

    Here are few things, i would like to mention...

    1) right click on the MSHFlexGrid1 and click on properties...
    2) under the tab 'General' change Allowuserresizing to 'Both' so when you resize the column, u'll see the effect at runtime
    keep the value of fixed col and fixed rows to 0
    3) Under the 'bands' tab check the option 'columnheader'
    4)
    VB Code:
    1. Private Sub Form_Load()
    2. MSHFlexGrid1.ColAlignmentHeader(0, 1) = 4
    3. End Sub

    Hope this helps...
    Last edited by Siddharth Rout; Mar 25th, 2007 at 08:41 AM.
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  16. #16
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Align Centre in MSHFlexgrid

    Puhleeezzzzzz tell me it works..........

    Have been scratching my head on this for hours now... lol
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  17. #17

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2006
    Location
    London, UK
    Posts
    817

    Re: Align Centre in MSHFlexgrid

    Thank you so much koolsid!!! It's got be baffled.

    RhinoBull
    Was a bit devestated when I found that I couldnt easily print a form with all controls. With a bit of help I ended upworking it out and posted ithere.

  18. #18

  19. #19
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Align Centre in MSHFlexgrid

    Thank you so much koolsid!!! It's got be baffled.
    Is that a yes? lol (is it working?)
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  20. #20

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2006
    Location
    London, UK
    Posts
    817

    Re: Align Centre in MSHFlexgrid

    You've got to be kidding me. How the did you work that out?
    I've had a bit of a play around already. It was the fixed col and fixed row values which were the problem. They were set to 1 and when I changed them to 0 I get my flexAlignCenterCenter.
    Thankyou!! Have to give you some reputation tomorrow too!!!

    OMG!! Didn't even know there was a additional properties screen for controls.


    RhinoBull. Please elaborate!! I was battling the print form problem for a week.
    Last edited by sgrya1; Dec 29th, 2006 at 09:35 PM.

  21. #21
    Banned
    Join Date
    May 2014
    Location
    OH
    Posts
    459

    Re: [RESOLVED] Align Centre in MSHFlexgrid

    nvm, wrong post
    Last edited by elRuffsta; Apr 29th, 2024 at 03:04 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width