|
-
Feb 20th, 2000, 11:13 PM
#1
Thread Starter
Lively Member
Hi, everybody!
I have a DataGrid which contains 2 columns. I’d like the user to not be allowed to add or change data in the 1rst. one, since it'll be filled by code.
The user also would be allowed to change data only in the last row.
Is there anyway I can "disable" some cells of a datagrid and allow others to be "enabled"?
Thanks in advance for any help,
Roselene
-
Feb 20th, 2000, 11:44 PM
#2
Hyperactive Member
Roselen,
In the RowColChange event
if datagrid1.col <> 1 then
'this would be the second col
msgbox "You cannot edit this column", vbokonly, "Error"
datagrid1.col = 1
end
for the row, you'd have to get or store the number of rows in the datagrid because it doesn't have a ROWS property. Then do the same:
If use ROWCOUNTER as the number of records in the datagrid, then go 1 less because first row is 0
dim ROWCOUNTER as integer
ROWCOUNTER = Data1.Recordset.RecordCount
'this is the number of records in the data control. I'm assuming that you are using a datagrid that's bound to a data control.
If datagrid1.row <> ROWCOUNTER -1
'then not on last row
msgbox "You can only edit the last row.",vbokonly, "Error"
datagrid1.row = ROWCOUNTER -1
end if
Yo umay have to play with the code a bit but it should work.
------------------
'cos Buzby says so!'
-
Feb 21st, 2000, 12:58 PM
#3
Thread Starter
Lively Member
netSurfer,
It works beautifully and you've helped to solve another problem. As usual, I must say!
Thanks very, very much!
Best wishes, 
Roselene
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
|