I have a datagrid and want to be able to have the user select an item
and then display details regarding that item in additional text boxes
(instead of user having to scroll over in a wide data grid). How
would I go about finding the row selected (or if user selected a
particular cell in a row) and placing the additional data elements in
text boxes?

Re: Select datagrid item to display details by Ibai

Ibai
Mon Aug 18 07:42:05 CDT 2003

watch this code:

int Line = dtgInvent.CurrentCell.RowNumber;
if (Linea > -1)
{
txtArtic.Text = TInvent.Rows[Line].ItemArray.GetValue(0).ToString();
}


Where dtgInvent is the datagrid, and TInvent is the DataTable (set as
dtgInvent´s datasource)
Put it in the datagrid´s mouseup event.

Regards,
--
Ibai Peña

"Dave C" <dchaffee@gfs.com> escribió en el mensaje
news:37db02df.0308180420.2769d56f@posting.google.com...
> I have a datagrid and want to be able to have the user select an item
> and then display details regarding that item in additional text boxes
> (instead of user having to scroll over in a wide data grid). How
> would I go about finding the row selected (or if user selected a
> particular cell in a row) and placing the additional data elements in
> text boxes?



Re: Select datagrid item to display details by John

John
Mon Aug 18 08:03:35 CDT 2003

An alternative is to use the CurrentRowIndex and a DataRow. Something like:

If dsTempItems.Tables(0).Rows.Count > 0 Then
rowIndex = dgTempItems.CurrentRowIndex
If rowIndex >= 0 Then
itemRow = dsTempItems.Tables(0).Rows(rowIndex)
tbxItem.Text = itemRow("Item")
etc.

Where dsTempItems is a DataSet
dgTempItems is a DataGrid
itemRow is a DataRow


"Ibai Peña" <igarle@hotmail.com> wrote in message
news:eQCr3YYZDHA.3436@tk2msftngp13.phx.gbl...
> watch this code:
>
> int Line = dtgInvent.CurrentCell.RowNumber;
> if (Linea > -1)
> {
> txtArtic.Text = TInvent.Rows[Line].ItemArray.GetValue(0).ToString();
> }
>
>
> Where dtgInvent is the datagrid, and TInvent is the DataTable (set as
> dtgInvent´s datasource)
> Put it in the datagrid´s mouseup event.
>
> Regards,
> --
> Ibai Peña
>
> "Dave C" <dchaffee@gfs.com> escribió en el mensaje
> news:37db02df.0308180420.2769d56f@posting.google.com...
> > I have a datagrid and want to be able to have the user select an item
> > and then display details regarding that item in additional text boxes
> > (instead of user having to scroll over in a wide data grid). How
> > would I go about finding the row selected (or if user selected a
> > particular cell in a row) and placing the additional data elements in
> > text boxes?
>
>



Re: Select datagrid item to display details by dchaffee

dchaffee
Mon Aug 18 21:28:54 CDT 2003

Thanks, but is there a Visual basic equivalent? Seems that setting to
exact row index does not work in vb.net for compact?


"John Atkins" <john@softwareunlimited.co.uk> wrote in message news:<eEmFkkYZDHA.2548@TK2MSFTNGP09.phx.gbl>...
> An alternative is to use the CurrentRowIndex and a DataRow. Something like:
>
> If dsTempItems.Tables(0).Rows.Count > 0 Then
> rowIndex = dgTempItems.CurrentRowIndex
> If rowIndex >= 0 Then
> itemRow = dsTempItems.Tables(0).Rows(rowIndex)
> tbxItem.Text = itemRow("Item")
> etc.
>
> Where dsTempItems is a DataSet
> dgTempItems is a DataGrid
> itemRow is a DataRow
>
>
> "Ibai Peña" <igarle@hotmail.com> wrote in message
> news:eQCr3YYZDHA.3436@tk2msftngp13.phx.gbl...
> > watch this code:
> >
> > int Line = dtgInvent.CurrentCell.RowNumber;
> > if (Linea > -1)
> > {
> > txtArtic.Text = TInvent.Rows[Line].ItemArray.GetValue(0).ToString();
> > }
> >
> >
> > Where dtgInvent is the datagrid, and TInvent is the DataTable (set as
> > dtgInvent´s datasource)
> > Put it in the datagrid´s mouseup event.
> >
> > Regards,
> > --
> > Ibai Peña
> >
> > "Dave C" <dchaffee@gfs.com> escribió en el mensaje
> > news:37db02df.0308180420.2769d56f@posting.google.com...
> > > I have a datagrid and want to be able to have the user select an item
> > > and then display details regarding that item in additional text boxes
> > > (instead of user having to scroll over in a wide data grid). How
> > > would I go about finding the row selected (or if user selected a
> > > particular cell in a row) and placing the additional data elements in
> > > text boxes?
> >
> >

Re: Select datagrid item to display details by John

John
Tue Aug 19 03:22:01 CDT 2003

That is vb.net from a CF program!

rowIndex is an unnecessary temporary variable introduced for "clarity".
There could well be another rowindex variable but I omitted showing the
local declaration of my integer rowIndex.

John.


"Dave C" <dchaffee@gfs.com> wrote in message
news:37db02df.0308181828.10c9bfbd@posting.google.com...
> Thanks, but is there a Visual basic equivalent? Seems that setting to
> exact row index does not work in vb.net for compact?
>
>
> "John Atkins" <john@softwareunlimited.co.uk> wrote in message
news:<eEmFkkYZDHA.2548@TK2MSFTNGP09.phx.gbl>...
> > An alternative is to use the CurrentRowIndex and a DataRow. Something
like:
> >
> > If dsTempItems.Tables(0).Rows.Count > 0 Then
> > rowIndex = dgTempItems.CurrentRowIndex
> > If rowIndex >= 0 Then
> > itemRow = dsTempItems.Tables(0).Rows(rowIndex)
> > tbxItem.Text = itemRow("Item")
> > etc.
> >
> > Where dsTempItems is a DataSet
> > dgTempItems is a DataGrid
> > itemRow is a DataRow
> >
> >
> > "Ibai Peña" <igarle@hotmail.com> wrote in message
> > news:eQCr3YYZDHA.3436@tk2msftngp13.phx.gbl...
> > > watch this code:
> > >
> > > int Line = dtgInvent.CurrentCell.RowNumber;
> > > if (Linea > -1)
> > > {
> > > txtArtic.Text = TInvent.Rows[Line].ItemArray.GetValue(0).ToString();
> > > }
> > >
> > >
> > > Where dtgInvent is the datagrid, and TInvent is the DataTable (set as
> > > dtgInvent´s datasource)
> > > Put it in the datagrid´s mouseup event.
> > >
> > > Regards,
> > > --
> > > Ibai Peña
> > >
> > > "Dave C" <dchaffee@gfs.com> escribió en el mensaje
> > > news:37db02df.0308180420.2769d56f@posting.google.com...
> > > > I have a datagrid and want to be able to have the user select an
item
> > > > and then display details regarding that item in additional text
boxes
> > > > (instead of user having to scroll over in a wide data grid). How
> > > > would I go about finding the row selected (or if user selected a
> > > > particular cell in a row) and placing the additional data elements
in
> > > > text boxes?
> > >
> > >