Results 1 to 9 of 9

Thread: Using DataGrid

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2006
    Posts
    111

    Red face Using DataGrid

    Hi,
    I need some help in using the DataGrid.

    I seem to manage to appear data located in my database,
    but I want to do some specific actions, for example:

    1. Some of the columns displayed cannot be changed by the user (I mean deleted, modified)
    2. Some other columns I want the user to be able to modify them (change their numerical value). And not just that,in addition I want one of the columns to be then calculated (by using the other columns), displayed and also saved in the database.

    3. On Form Load I want to re-calculate the 'calculated column' and also, display a total (in a label for example) at the end, (or maybe in a row)... like we do in excel...

    Can anyone please help with any of those??? Is there a guide for all of this? I have a book but it refers to this only in 1-2 pages, and I can't seem to make it work... Please please help!

    Thx

  2. #2
    Hyperactive Member
    Join Date
    Feb 2006
    Location
    Philippines
    Posts
    468

    Re: Using DataGrid

    1. Some of the columns displayed cannot be changed by the user (I mean deleted, modified)
    right click on the datagrid an on the properties on the layout tab there is a checked box locked... column property
    2. Some other columns I want the user to be able to modify them (change their numerical value). And not just that,in addition I want one of the columns to be then calculated (by using the other columns), displayed and also saved in the database.

    3. On Form Load I want to re-calculate the 'calculated column' and also, display a total (in a label for example) at the end, (or maybe in a row)... like we do in excel...

    Can anyone please help with any of those??? Is there a guide for all of this? I have a book but it refers to this only in 1-2 pages, and I can't seem to make it work... Please please help!
    datagrid has limitations.... you should create a calculated field in your database
    if you are using access db create a query with a calulated field
    field total:fld1+fld2

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2006
    Posts
    111

    Re: Using DataGrid

    ok, thanx.

    Can anyone also explain to me how is the DataGrid refreshed/ updated?

    I mean, what if I allow the user to make changes in fields through the data grid, are the changes automatically updated
    1. in the database
    2. can the calculated field change, after we have made the changes? in the current view of the datagrid AND in the database (access)??

    thx

  4. #4
    Hyperactive Member
    Join Date
    Feb 2006
    Location
    Philippines
    Posts
    468

    Re: Using DataGrid

    I mean, what if I allow the user to make changes in fields through the data grid, are the changes automatically updated
    1. in the database
    yes if the allowupdate ot hte datagrid is true
    [QUOTE]2. can the calculated field change, after we have made the changes? in the current view of the datagrid AND in the database (access)??[QUOTE]
    the current recordset must be refresh before you can see the changes...

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Feb 2006
    Posts
    111

    Re: Using DataGrid

    I am having a datagrid showing the results from an SQL statement:
    "Select numberA,numberB from ATable" but I want to make extra calculations on these fields, for example I want another extra column to appear, lets say Result = numberA+numberB, next to column with numberB but such column does not exist in my database. And furthermore I want to add all the records of this column to give me a total in a label in the form.

    Can anyone please please please help me with this???

  6. #6
    New Member
    Join Date
    Feb 2006
    Location
    India
    Posts
    12

    Re: Using DataGrid

    hi,
    is there any way using datagrid that in one particular column i can display a set of values out of which user will select one

  7. #7
    Hyperactive Member
    Join Date
    Feb 2006
    Location
    Philippines
    Posts
    468

    Re: Using DataGrid

    is there any way using datagrid that in one particular column i can display a set of values out of which user will select one
    Using the ComboBox control as a repository for the contents of the lookup table
    All you have to do is make the ComboBox control appear in front of the DataGrid control, exactly over the cell ypu edited, and then update the underlying cell

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Feb 2006
    Posts
    111

    Re: Using DataGrid

    Can you explain this a bit more please?????

  9. #9
    Hyperactive Member
    Join Date
    Feb 2006
    Location
    Philippines
    Posts
    468

    Re: Using DataGrid

    I am having a datagrid showing the results from an SQL statement:
    "Select numberA,numberB from ATable" but I want to make extra calculations on these fields, for example I want another extra column to appear, lets say Result = numberA+numberB, next to column with numberB but such column does not exist in my database.
    on your sql statement
    "select column_a,Column_b, column_a+column_b as column_c from table1"
    And furthermore I want to add all the records of this column to give me a total in a label in the form.

    Can anyone please please please help me with this???
    use sql statement to sum all values on column c
    select column_a,Column_b, sum(column_a+column_b )as column_c from table1
    label1.caption= rs.fields("column_c")
    Can you explain this a bit more please?????
    you can create a lookup table on a particular column using a combobox
    it requires the DataGrid control's RowHeight property match the ComboBox's Height property and then make the ComboBox appear inside the DataGrid selected column

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