CellMouseClick on in certain column

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
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.
This topic is 3 years and 2 weeks old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
swindmiller
Posts: 64
Last visit: Tue Aug 22, 2023 11:59 am

CellMouseClick on in certain column

Post by swindmiller »

Sorry if this is obvious but I am just not getting it :D

I have a DataGridView that I have a button column in. I added this:
$datagridviewPartsNeeded.add_CellMouseClick and this works fine but works if I click any cell in the row. I would like to just have it trigger if I click the cell in that particular column.

Can I do that?

Scott
User avatar
swindmiller
Posts: 64
Last visit: Tue Aug 22, 2023 11:59 am

Re: CellMouseClick on in certain column

Post by swindmiller »

I think I figured this out unless there is a better way:
$datagridviewPartsNeeded.add_CellMouseClick({
If ($datagridviewPartsNeeded.CurrentCell.ColumnIndex -eq 6)
This topic is 3 years and 2 weeks old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked