Phone: 905 409-1589
Email: info@penproductions.ca
RSS LinkedIn Twitter Twitter
DataGridView
Navigate:
Getting Started:
DataGridView is an excellent option for creating a list type user interface object that can contain more then just simple text as is the case with ListView. DataGridView has the ability to have text, buttons, check boxes and a host of other objects displayed in each cell of any given row.

Using DataGridView is a bit more complex then setting up ListView how ever it will allow for a more robost solution when more is needed.

This example will be created using a Hybrid Max Script/DotNet UI. If you are unfamiliar with this please refer to the examples on the DotNet tutorial page.

Example Code:
Below is the source code that we will be using for this tutorial.
Code:
try(destroyDialog testR)catch()
rollout testR "Test"
(
    dotNetControl cc "containerControl" width:(testR.width-8) height:(testR.height-10) offset:[-9,0]
    
    fn initDGV=
    (
        dgv=dotNetObject "dataGridView"
        dgv.rowHeadersVisible=false
        dgv.autoSizeColumnsMode=dgv.autoSizeColumnsMode.fill
        dgv.dock=dgv.dock.fill
        cc.controls.add dgv
        
        --Setup columns. 
        col=dotNetObject "DataGridViewColumn"
        cell=dotNetObject "DataGridViewTextBoxCell"
        col.cellTemplate=cell
        col.HeaderText="Text"
        dgv.columns.add col
        
        col=dotNetObject "DataGridViewColumn"
        cell=dotNetObject "DataGridViewImageCell"
        col.cellTemplate=cell
        col.HeaderText="Image"
        dgv.columns.add col
        
        col=dotNetObject "DataGridViewColumn"
        cell=dotNetObject "DataGridViewButtonCell"
        col.cellTemplate=cell
        col.HeaderText="Button"
        dgv.columns.add col
        
    )
    
    on testR open do 
    (
        initDGV()
    )
)
createDialog testR width:500 height:600