Results 1 to 8 of 8

Thread: DATAGRID?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 1999
    Location
    Nottingham
    Posts
    20

    Post

    Does anyone know how to set the format of a DataGrid column, where the DataGrid is bound to an ado recordset at runtime?

  2. #2
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105

    Post

    If it's anything like DAO, it's one of those things about bound controls that bother me.

    With DAO, formatting (on the bound fields) is lost when the update method is issued. You need to re-format the bound fields after the ".update" occurs.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jan 1999
    Location
    Nottingham
    Posts
    20

    Post

    The recordset is bound at run time (set datagrid.datasource = Rs). What I want to do is set the format of a particular column at run-time after the grid has been bound to the recordset.

  4. #4
    Lively Member
    Join Date
    Jan 1999
    Location
    Gloucester, UK
    Posts
    78

    Post

    Well, if your refering to column sizes etc...

    The syntax is something along the lines of:-

    dbgrid1.colums(0).width = 3000
    dbgrid1.columns(0).caption = "Hello"

    By default I don't think VB shows these properties with the auto-complete.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Jan 1999
    Location
    Nottingham
    Posts
    20

    Post

    I was actually refering to the column format, i.e Boolean, Short Date etc.


  6. #6
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105

    Post

    The answer, then, is most likely no. The data types of the columns are determined by the bindings. You might want to give some thought to having two grids, one bound, the other unbound that overlay one another.

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Jan 1999
    Location
    Nottingham
    Posts
    20

    Post

    Unfortunately the recordsets I am dealing with are disconected and are bound at run-time. To bind a grid to a dataanvironment or data control would compomise the structure of the application.

  8. #8
    New Member
    Join Date
    Sep 1999
    Posts
    7

    Post

    try right clicking on the control in design time and bring up the properties box. There is a list of formats under the column tab and in the Number Format drop down box you can choose the format you want to put into your code. Remember to use quotes.

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