using datagrid field values in multiple forms

G

Guest

In form1, which is an item master maintenance screen, I have a button which
launches form2. Form2 contains an item master datagrid. After the user
double-clicks the desired item record in form2 I want the field values from
the selected record to populate text boxes in form 1 so the user can make
changes to the item (ie. description, cost etc.). I have gotten as far as
populating a field in form1 with the mapping name or the current row index
from the datagrid as shown in the code directly below but not the actual
field value.
myForm1.ItemId = dgdMinorMaterial1.CurrentRowIndex

I tried this code below, which looks good, but I receive the error message
that follows.
myForm1.ItemId = MinorMaterialDataSet1.tblMinorMaterial.mmItemIdColumn
Value of type 'System.Data.DataColumn' cannot be converted to 'String'.

Can anyone help me out here? Thanks.
 
D

Dave

Use the DataGrid indexer:

Gets or sets the value of the cell at the specified the row and column.

public object this[
int rowIndex,
int columnIndex
] {get; set;}

^^ From MDSN.
 
G

Guest

Thanks Dave, That sent me in right direction and I got it to work, now I can
stop pulling my hair out.

Dave said:
Use the DataGrid indexer:

Gets or sets the value of the cell at the specified the row and column.

public object this[
int rowIndex,
int columnIndex
] {get; set;}

^^ From MDSN.

--
Dave Sexton
[email protected]
-----------------------------------------------------------------------
Wishing I was skiing mom said:
In form1, which is an item master maintenance screen, I have a button which
launches form2. Form2 contains an item master datagrid. After the user
double-clicks the desired item record in form2 I want the field values from
the selected record to populate text boxes in form 1 so the user can make
changes to the item (ie. description, cost etc.). I have gotten as far as
populating a field in form1 with the mapping name or the current row index
from the datagrid as shown in the code directly below but not the actual
field value.
myForm1.ItemId = dgdMinorMaterial1.CurrentRowIndex

I tried this code below, which looks good, but I receive the error message
that follows.
myForm1.ItemId = MinorMaterialDataSet1.tblMinorMaterial.mmItemIdColumn
Value of type 'System.Data.DataColumn' cannot be converted to 'String'.

Can anyone help me out here? Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top