Connecting Tech Pros Worldwide Forums | Help | Site Map

Selected object in datagrid

DC
Guest
 
Posts: n/a
#1: Nov 21 '05
Hi all (once again),
I've populated a datagrid with an arraylist of objects of this class i've
created.

How can I get the select object in the datagrid?

TIA,
DC
Not Aaron
Guest
 
Posts: n/a
#2: Nov 21 '05

re: Selected object in datagrid


If you are wanting the value of a cell, you would use

datagrid.item(datagrid.currentcell)

you should use that within a mouseDown or mouseUp event of the
datagrid. I dont know if that answers your question, because I dont
100% understand it.

DC
Guest
 
Posts: n/a
#3: Nov 21 '05

re: Selected object in datagrid


Thanks,
Here's exactly what I want: Just like Listbox select item returns a
reference for MY object, I would like to know if there's any way to have the
reference for MY object in the select item of a datagrid. I don't want to get
the cell value, but a reference to the object of my arraylist.
I hope that's clear now.

"Not Aaron" wrote:
[color=blue]
> If you are wanting the value of a cell, you would use
>
> datagrid.item(datagrid.currentcell)
>
> you should use that within a mouseDown or mouseUp event of the
> datagrid. I dont know if that answers your question, because I dont
> 100% understand it.
>
>[/color]
Not Aaron
Guest
 
Posts: n/a
#4: Nov 21 '05

re: Selected object in datagrid


datagrid.item(datagrid.currentcell) is pretty much like a
listbox.selectedItem, they both bring back the value of whats selected.
If you wanted to get the row number of the datagrid thats selected you
could use datagrid.currentRowIndex but I dont know if that corresponds
to your arraylist. Im guessing that the order of your datagrid won't
always be the same as the arraylists order, so I think you could get
the cell value of the selected row in the datagrid and search for its
position in your arraylist. Is this sort of what you're looking for?

Closed Thread