DESELECT row in datagridview by defolt

table.rows.clear()
table.ClearSelection
table.CurrentCell = Nothing

--doesn't help

table.CurrentRow.Selection = False --gives error

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
artrender.info's picture

THANKS A LOT

this code worked for me:

table.rows.item[0].cells.item[0].Selected = False
artrender.info's picture

STILL ERROR

Even with counter = 0

AttachmentSize
still-eror.jpg 125.45 KB
Anubis's picture

change all (counter) to [counter]

Yep, I think we miss the syntax conversion :)

In DotNet languages call to item by index is surrounded with round brackets "()", for example: table.Rows(counter).Index, while in MaxScript with square brackets "[]", like: table.Rows[counter].Index.

So, fix that too (in all places), and lets hope there no more chunks.

my recent MAXScripts RSS (archive here)

artrender.info's picture

I didn't use uny value

I have just used your code! I don't what value should I use for counter!

Anubis's picture

integer

the "counter" in the example code serve as variable, it s'd be integer value, for example 0.
counter = 0

my recent MAXScripts RSS (archive here)

artrender.info's picture

Thx Anubis!

		table.SelectionMode = (dotNetClass "System.Windows.Forms.DataGridViewSelectionMode").FullRowSelect
		table.RowHeadersVisible = false
 
		table.FirstDisplayedScrollingRowIndex = table.Rows(counter).Index
		table.Refresh() -- refresh after scroll
		table.CurrentCell = table.Rows(counter).Cells(1)
		table.Rows(counter).Selected = True -- use #Selected with Boolean

I get error

Type error: Call needs function or class, got:
 
dotNetObject:System.Windows.Forms.DataGridViewRowCollection
table.CurrentRow.Selected = False 

gives -- Unknown property: "selected" in undefined

Anubis's picture

probably something missed

what you used for "counter" value?
counter = ?.. --some integer

my recent MAXScripts RSS (archive here)

Anubis's picture

...

I not use DataGridView so take my words as friendly attempt to help. What I did is just quick search.

I'm not sure if there exist #Selection property for CurrentRow, but found that CurrentCell cannnot be set to Nothing. You s'd set that property to valid Cell which s'd be visible as well, i.e. need to scroll if necessary. Shortly, something like this:

--counter = ...
--DVG.ClearSelection()
DGV.FirstDisplayedScrollingRowIndex = DGV.Rows(counter).Index
DGV.Refresh() -- refresh after scroll
DGV.CurrentCell = DGV.Rows(counter).Cells(1)
DGV.Rows(counter).Selected = True -- use #Selected with Boolean

I hope this help

my recent MAXScripts RSS (archive here)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.