473,503 Members | 1,722 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

using datagrid field values in multiple forms

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.mmItemIdCol umn
Value of type 'System.Data.DataColumn' cannot be converted to 'String'.

Can anyone help me out here? Thanks.
Jul 21 '05 #1
2 1698
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
dave@www..jwaonline..com
-----------------------------------------------------------------------
"Wishing I was skiing mom" <Wi******************@discussions.microsoft.com> wrote in message
news:B8**********************************@microsof t.com...
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.mmItemIdCol umn
Value of type 'System.Data.DataColumn' cannot be converted to 'String'.

Can anyone help me out here? Thanks.

Jul 21 '05 #2
Thanks Dave, That sent me in right direction and I got it to work, now I can
stop pulling my hair out.

"Dave" wrote:
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
dave@www..jwaonline..com
-----------------------------------------------------------------------
"Wishing I was skiing mom" <Wi******************@discussions.microsoft.com> wrote in message
news:B8**********************************@microsof t.com...
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.mmItemIdCol umn
Value of type 'System.Data.DataColumn' cannot be converted to 'String'.

Can anyone help me out here? Thanks.


Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
9831
by: Wendy Powley | last post by:
I have a subform which represents a 1:N relationship with the main form. I would like to be able to read values from an external file, fill the subform with the values read & allow the user to...
19
4065
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
2
9905
by: Chris Plowman | last post by:
Hi all, I was wondering if anyone can help me with a really annoying problem I have been having. I made a derived datagrid class that will select the row when a user clicks anywhere on a cell...
5
2013
by: junglist | last post by:
Hi guys, I've been trying to implement an editable datagrid and i have been succesful up to the point where i can update my datagrid row by row. However what used to happen was that once i updated...
0
1156
by: Becker | last post by:
I have a datatable that I use to display running processes. These running processes are spawned as different threads. I use the readerwriterlock class to ensure that when I write to the datatable,...
3
3301
by: Lars Netzel | last post by:
(applies to Windows Form .NET 2003) I'm filling a datagrid from a Datatable and applying a DataGridStyle. The Source Fields are "Name", "Value", "Locked" and the Style's Columns are "Name",...
2
310
by: Wishing I was skiing mom | last post by:
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...
13
2427
by: shookim | last post by:
I don't care how one suggests I do it, but I've been searching for days on how to implement this concept. I'm trying to use some kind of grid control (doesn't have to be a grid control, whatever...
0
7086
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7332
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7462
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3167
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
382
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.