Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Editing A DataGrid

Status
Not open for further replies.

Hackster

Programmer
Mar 28, 2001
173
US
I did a forum search on DataGrid and found 80 posts. None of them had any replies, so I'm not real confident about this one, but what the heck.

Is it possible to edit data displayed in a datagrid on the grid itself?

I can click on a cell, display the text portion in a textbox, write the change back to my Db, refresh the grid so the change shows, but I'm being asked to build in the functionality for editing the grid itself, and I'm not sure that can be done.

However, I need other opinions before taking this one back to the boss.
 
In properties set AllowUpDate = True.

I have several questions about the datagrid. When I try to set the width property of individual columns or name the indvidual colums, nothing displays. However, when 'retrieve fields' is clicked data is displayed.

1. Is there a way to set the width of the fields?
2. The data to be displayed can fill six rows or more. Is there a way to have the datagrid expand dynamically?

Thank you.

Kim
 
AllowUpDate is set to True, and I still can't edit the darn thing.
 
The standard method of doing this is to use MSFlexgrid. The trick was originally published on MSDN, now copied to faq222-3262

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
You may not be able to edit the data grid because you are using a non-updatable record source. There's also a possibility that attempting to edit a unique index or one that doesn't allow NULLS will fail if you violate the constraints defined in the database.

PS - The zero-replies thing is a bug that the operators of Tek-Tips know about and are working on. If you open those posts you will see that most of them do have replies even though it says zero.
 
None of them had any replies
The search function returns that there are no (zero) replies. But if you open a thread you will see that there are replies in it. It's a bug.

zemp
 
I did a 'datagrid' search also and got a 'no results for ...' response.

To set the widths, alignment, caption, et al of a datagrid
Code:
    With datagrid1
        .Columns(0).Width = 500
        .Columns(0).Alignment = dbgRight
        .Columns(0).Locked = True
        .Columns(1).Width = 4000
        .Columns(2).Width = 600
        .Columns(2).Alignment = dbgRight
        .Columns(0).Caption = "ID"
    End With

If the border is set to none, when the data fills more than the runtime setting for the height of the grid, a scoll arrow appears on the right side.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top