|
-
Feb 16th, 2006, 09:42 AM
#1
Thread Starter
Lively Member
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
-
Feb 16th, 2006, 10:16 AM
#2
Hyperactive Member
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
-
Feb 16th, 2006, 10:54 AM
#3
Thread Starter
Lively Member
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
-
Feb 16th, 2006, 10:57 AM
#4
Hyperactive Member
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...
-
Feb 21st, 2006, 04:49 AM
#5
Thread Starter
Lively Member
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???
-
Feb 21st, 2006, 05:44 AM
#6
New Member
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
-
Feb 21st, 2006, 10:34 AM
#7
Hyperactive Member
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
-
Apr 5th, 2006, 02:47 AM
#8
Thread Starter
Lively Member
Re: Using DataGrid
Can you explain this a bit more please?????
-
Apr 5th, 2006, 08:14 AM
#9
Hyperactive Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|