Notifications
Clear all

[Closed] [dotNET] retrieve DataGridView cell values

I have a DataGridView in a rollout made of 2 columns and dynamically driven number of rows.

The user changes the values in the cells, then I need to retrieve those values as arrays like :

#(column1, column2)

here is my script so far

	dotnet.loadassembly "System.Data" 
 	
 	rollout rlt_animationTable "animation table" width:320 height:300
 	(
 		dotNetControl AnimationTable "System.Windows.Forms.DataGridView" pos:[13,7] width:294 height:14
 		
 		on rlt_animationTable open do
 		(
 			local ObjectsCol = dotNetObject "System.Windows.Forms.DataGridViewTextBoxColumn"
 			ObjectsCol.headerText = "Object"
 			
 			local FrameCol = dotNetObject "System.Windows.Forms.DataGridViewTextBoxColumn"
 			FrameCol.headerText = "Frame"
 			
 			AnimationTable.columns.add ObjectsCol
 			AnimationTable.columns.add FrameCol
 			
 			AnimationTable.Location = dotNetObject "System.Drawing.Point" 0 0
 			AnimationTable.rowcount = 2
 		)		
 	)
 
 createdialog rlt_animationtable 300 300

How can i get those values from dotNet to Maxscript variables such as array ?

2 Replies

 vals = for i=0 to [color=Silver][color=LightBlue]<theGridView>[/color][/color].rows.item[rowIndex].cells.count-1 collect <theGridView>.rows.item[rowIndex].cells.item[i].value 
 

Oh that’s perfect! thanks Denis !