CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 27 of 27
  1. #16
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: Database field format in FlexGrid

    Is using the Flexgrid a requirement? As far as I know there is no way to auto format the data in a flex grid but this can be done easily in a DBGrid. Would you be able to use that instead?
    Always use [code][/code] tags when posting code.

  2. #17
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Database field format in FlexGrid

    He wants to CHANGE THE FONT.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #18
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: Database field format in FlexGrid

    Quote Originally Posted by dglienna View Post
    He wants to CHANGE THE FONT.
    Where did you see this? I see no reference to changing font anywhere in the thread except your post. I see that he wants to change the format which is simple with the dbgrid, you can afaik also change the font for the dbgrid as a whole.
    Always use [code][/code] tags when posting code.

  4. #19
    Join Date
    Jul 2005
    Posts
    1,083

    Re: Database field format in FlexGrid

    Have you tried to write all the fields of the record instead of use the *
    Example
    SELECT Fieldname1, Fieldname2, Format(Fieldname3,"dd/mm/yyyy" ), Fieldname4 FROM ...
    JG


    ... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...

  5. #20
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Database field format in FlexGrid

    Edited to say FORMAT rather than FONT. Don't know what CG did to the edit...
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  6. #21
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,725

    Re: Database field format in FlexGrid

    Sorry for late replying, still suffer from sickness.

    @jggtz: I have selected the fields to go to the list all by name. No "*".
    I will try this:
    SELECT Fieldname1, Fieldname2, Format(Fieldname3,"dd/mm/yyyy" ), Fieldname4 FROM ...
    although I never saw something like a format statement embedded in an sql query. Thanks.

    @DataMiser and David: I used MSHFlexGrid, because I was already familiar to it. I might try DataGrid if you say it can change the format for a column, but I have one thing in common to all lists in the program: I have made sorting occur when clicking on the column headers. Should be able to handle this in a similar way with DataGrid. I will take a look to that control, thanks.

  7. #22
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Database field format in FlexGrid

    Normal Flexgrid lets you intercept click events. Look for the FLOATING TEXTBOX examples to replace actual cells with input.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  8. #23
    Join Date
    Jul 2005
    Posts
    1,083

    Re: Database field format in FlexGrid

    Right syntax
    Code:
    SELECT Fieldname1, Fieldname2, Format(Fieldname3,'dd/mm/yyyy' ) As Exprname3, Fieldname4
    FROM    Tablename1
    https://www.google.com.mx/#hl=es-419...iw=800&bih=457
    JG


    ... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...

  9. #24
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Database field format in FlexGrid

    Why post TWICE?
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  10. #25
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,725

    Re: Database field format in FlexGrid

    Seems because there is a link now to the source of the information.

    I don't need to change data while in grid view. It is only for display.

  11. #26
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,725

    Re: Database field format in FlexGrid

    Ok, fine.
    jggtz, your solution works perfect. I have to change the final query string just before I open the recordset, though, but this is a minor change in the end.

    Very good. Thank you.

  12. #27
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,284

    Re: [RESOLVED] Database field format in FlexGrid

    good work jggtz

    Unbelievable

Page 2 of 2 FirstFirst 12

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

Featured