Product, version and build: Powershell Studio 2016 5.3.131
32 or 64 bit version of product:64
Operating system:W7
32 or 64 bit OS:64
PowerShell Version:4
In a nutshell, I would like to insert buttons into the cells of a particular column to give the end user an easy way of editing/deleting the row in question by clicking the appropriate button (the population of the datagridview only contains a subselection of the information that may need to be edited).
Regards
Ian
Adding buttons to DataGridView Column cells
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: Adding buttons to DataGridView Column cells
[TOPIC MOVED TO THE POWERSHELL GUIS FORUM]
David
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: Adding buttons to DataGridView Column cells
Fingers crossed.....third time I've posted this reply!
I'd spotted the datagrdiviewbuttoncolumn, which I've added, and works ok for what it is.
Ideally I would have liked to put a few buttons, but I can easily add a few datagridviewbuttoncolumns.
What I would now like to do is add an icon to the button rather than just plain text, certainly the aesthetics are much better....played around with datagridviewimagecolumn, but the button column ensures it acts like a button when clicking.
Could you advise how I could do this?
Thanks
Ian
I'd spotted the datagrdiviewbuttoncolumn, which I've added, and works ok for what it is.
Ideally I would have liked to put a few buttons, but I can easily add a few datagridviewbuttoncolumns.
What I would now like to do is add an icon to the button rather than just plain text, certainly the aesthetics are much better....played around with datagridviewimagecolumn, but the button column ensures it acts like a button when clicking.
Could you advise how I could do this?
Thanks
Ian
Re: Adding buttons to DataGridView Column cells
You can't. In this situation we would use a context menu. You can also use a checkbox and arrange pretty buttons next to the grid that operate on selected rows.
Re: Adding buttons to DataGridView Column cells
Thanks for the quick response, what do you mean by Context Menu?
Previously I've had a textbox somewhere which shows selected user for example, with option buttons, I just wanted to make it a bit neater.
Presumably quite a bit of extra work to put separate icons outside the gridview as would have to create these on the fly presumably depending on how many rows are returned to the gridview, if less rows than the full view.
I'm just wondering whether to stick with the imagecolumn....nothing quite ideal unfortunately.
Ian
Previously I've had a textbox somewhere which shows selected user for example, with option buttons, I just wanted to make it a bit neater.
Presumably quite a bit of extra work to put separate icons outside the gridview as would have to create these on the fly presumably depending on how many rows are returned to the gridview, if less rows than the full view.
I'm just wondering whether to stick with the imagecolumn....nothing quite ideal unfortunately.
Ian
Re: Adding buttons to DataGridView Column cells
I recommend reading the blog posts here on using forms. You seem to be missing most or teh design fundamentals.
There is a post on context menus here: http://info.sapien.com/index.php/guis/gui-scripting
You will find many articles on ways to sex up a form including fade-outs and animations. Once you have an understanding of forms you will see many ways to get your project done painlessly.
There is a post on context menus here: http://info.sapien.com/index.php/guis/gui-scripting
You will find many articles on ways to sex up a form including fade-outs and animations. Once you have an understanding of forms you will see many ways to get your project done painlessly.
Re: Adding buttons to DataGridView Column cells
Yep I get what you mean now. Unfortunately I get very little chance to do anything like this, and so almost have to start from scratch each time.
Another option I'm looking at is to use the datagridviewimagecolumn and when a cell is that column is clicked change the background color or similar, then at least there's a response to the click.
Cheers
Ian
Another option I'm looking at is to use the datagridviewimagecolumn and when a cell is that column is clicked change the background color or similar, then at least there's a response to the click.
Cheers
Ian
Re: Adding buttons to DataGridView Column cells
Just catch the cell click and do what you need. Now is the time to take to learn how to work with forms. Once you read the articles you will have enough information to build without forgetting.IanUoY wrote:Yep I get what you mean now. Unfortunately I get very little chance to do anything like this, and so almost have to start from scratch each time.
Another option I'm looking at is to use the datagridviewimagecolumn and when a cell is that column is clicked change the background color or similar, then at least there's a response to the click.
Cheers
Ian