Notifications
Clear all
[Closed] DotNet Arrays
Jul 25, 2007 10:45 am
Is there any way to get arrays work in maxscript DotNet connection? I’m trying to get table ui element working but without getting arrays to work, it seems impossible.
-- The table object
dataGridView1 = dotNetObject "System.Windows.Forms.DataGridView"
dataGridView1.ColumnCount = 5
dataGridView1.EditMode = (dotNetClass "System.Windows.Forms.DataGridViewEditMode").EditOnEnter
dataGridView1.Name = "dataGridView1";
dataGridView1.Location = dotNetObject "System.Drawing.Point" 8 8
dataGridView1.Size = dotNetObject "System.Drawing.Size" 500 300
dataGridView1.AutoSizeRowsMode = (dotNetClass "System.Windows.Forms.DataGridViewAutoSizeRowsMode").DisplayedCellsExceptHeaders
dataGridView1.ColumnHeadersBorderStyle = (dotNetClass "System.Windows.Forms.DataGridViewHeaderBorderStyle").Raised
dataGridView1.CellBorderStyle = (dotNetClass "System.Windows.Forms.DataGridViewCellBorderStyle").Single
dataGridView1.RowHeadersVisible = false
dataGridView1.MultiSelect = false;
-- The problematic part
dataGridView1.Columns[1].Name = "Track"
-- The DotNet form
dForm = dotNetObject "System.Windows.Forms.Form"
dForm.controls.add dataGridView1
dForm.topmost = true
dForm.show()
As you can see I need to defined column names using arrays. Or is there some way around it, so I wouldn’t have to use arrays?
2 Replies
Jul 25, 2007 10:45 am
Change this line :
dataGridView1.Columns[1].Name = “Track”
To (the collection array is zero-based) :
dataGridView1.Columns.Item[0].Name = “Column 1”
This is the way all .Net collections can be accessed, like the ListView control:
the ActiveX way:
myListView.ListItems[1].Text = “Test”
The .Net way:
myListView.Items.Item[0].Text = “Test”
Cheers,
Martijn