|
-
Jan 22nd, 2004, 10:20 AM
#1
Thread Starter
Member
Add column with buttons to datagrid
Hi guys,
I have a dataset DSExcel which contains a datatable with 6 columns. I also have a windows (not ASP) datagrid whose datasource is set to the dataset. The datagrid contains a tablestyle.
What I want to do is to add a column (tthe seventh column) to the datagrid (and dataset) which contains a button in very row. I also must be able to detect if the button in the datagrid cell is clicked.
Is there anybody who can help me with this. I searched the internet and found a lot of examples for an ASP-datagrid but none for a windows datagrid.
A code example would be welcome.
Thanks
-
Jan 24th, 2004, 12:39 PM
#2
Addicted Member
Actually you dont need a button in every row, if you put a button on a form you can determine what row is selected from the button_click event.
VB Code:
intRowIndex = DataGrid1.CurrentCell.RowNumber
msgbox(DataGrid1.Item(intRowIndex,intColumnIndex))
This will display a msgbox with the selected rows cell text based on the column that you specify.
-
Jan 25th, 2004, 05:46 AM
#3
Thread Starter
Member
thanks jwmoore,
but the code you suggested just retrieves the index of the column and row of the clicked cell and it returns the value of that cell.
The code doesn't work in a winforms datagrid because you can't detect a click in a datagrid (or am i wrong?).
I still would like to create a column with buttons....
Any ideas?
Thanks,
Tom
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
|