[Solved] Command buttons on GridView view

Post

Posted
Rating:
#1 (In Topic #1092)
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’
Hi everyone

Not sure if this has been asked before but I need some help, does anyone know how I can have a set of command buttons on a row on a GridView?

Below is a example of what I mean (what I want to have is edit / delete / duplicate)

<IMG src="https://www.codeproject.com/KB/grid/DGV_ImageButtonCell/CodeProject01.JPG"> </IMG>

If anyone could show me an example or point me in the right direction that would be most appreciated.

Thanks

Andy
Online now: No Back to the top

Post

Posted
Rating:
#2
Guru
BruceSteers is in the usergroup ‘Guru’
 What's a DataGrid view ?

I cannot find DataGrid on the wiki anywhere.
Online now: No Back to the top

Post

Posted
Rating:
#3
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’
 My bad I am so sorry it is a GridView (DataGrid is from VB.NET I'm still migrating over from windows)
Online now: No Back to the top

Post

Posted
Rating:
#4
Guru
BruceSteers is in the usergroup ‘Guru’
 Thank you.

A GridView is a ScrollView at heart and the grid and it's items are drawn.
So it's contents (cells) are not individual containers you can add controls to like Buttons.

The easiest way to get what you want is to use the _GridView_Cell.Picture property to use an image and make it act like a button.

See the attached project.
I customised GridView to have a .MakeButton() method

    GridView1.MakeButton(GridView1.Rows.Max, 0, "icon:/22/edit")

It makes a fake button and responds to clicks using a ButtonClick() event.

  Public Sub GridView1_ButtonClick(Row As Integer, Column As Integer)

Putting the attached projects GridView.class in your own projects .src directory and hitting "compile all" will allow you to do the same for your GridViews

Image

(Click to enlarge)

Online now: No Back to the top

Post

Posted
Rating:
#5
Regular
vuott is in the usergroup ‘Regular’

AndyGable said

how I can have a set of command buttons on a row on a GridView?
If you want, you can insert a Button in a cell of the GridView:
 :?    Inserire un oggetto in una cella di una GridView - Gambas-it.org - Wikipedia

Europaeus sum !

<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Online now: No Back to the top

Post

Posted
Rating:
#6
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’

vuott said

AndyGable said

how I can have a set of command buttons on a row on a GridView?
If you want, you can insert a Button in a cell of the GridView:
 :?    Inserire un oggetto in una cella di una GridView - Gambas-it.org - Wikipedia

Thank for that post I shall have a read and go from there

This is what I am looking for :)
Online now: No Back to the top
1 guest and 0 members have just viewed this.