[SOLVED] Get cell value from DataGridView

[SOLVED] Get cell value from DataGridView

Anonymous
Not applicable
819 Views
3 Replies
Message 1 of 4

[SOLVED] Get cell value from DataGridView

Anonymous
Not applicable
i'm trying to get the value from a cell but every time it give error.
First i tried :
newvalue = datagridview.value

but it gave syntax error, looks like Maxscript needs update because this works in C#
then i wrote
newvalue = datagridview.rows.cells.value

and it also give error when i click on button
-- No ""get"" function for dotNetObject:System.Windows.Forms.DataGridViewRowCollection <<


any idea ?
0 Likes
820 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
solved...after alot of experimenting i have found that Max script do not support dotnet Collections. Thats why i developed my own DGV and append some usefull functions.
0 Likes
Message 3 of 4

Anonymous
Not applicable
I have had success accessing the "item" property of .NET collections explicitly to get at the contents of collections:

fn onLoadHandler obj evt =
(
dgv = dotnetobject "datagridview"
dgv.columns.add "col0" "Column 0"
dgv.columns.add "col1" "Column 1"
dgv.rows.add()
dgv.rows.add()

obj.controls.add dgv

dgv.rows.item.cells.item.value = "FOOF"
dgv.rows.item.cells.item.value = "FIIF"

-- You can access columns by names too
dgv.rows.item.cells.item.value = "FEEF"
dgv.rows.item.cells.item.value = "FAAF"

format "entry 1,1 is %\n" dgv.rows.item.cells.item.value

)

fn CreateForm =
(
local frm
frm = dotNetObject "System.Windows.Forms.Form"
dotnet.AddEventHandler frm "Load"onLoadHandler
frm
)

myForm = CreateForm()
myForm.show()
0 Likes
Message 4 of 4

Anonymous
Not applicable
thats not in dotnet, mate why you too late coz i did alot of things to get it work anyway thanks
0 Likes