473,809 Members | 2,736 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 = dgdMinorMateria l1.CurrentRowIn dex

I tried this code below, which looks good, but I receive the error message
that follows.
myForm1.ItemId = MinorMaterialDa taSet1.tblMinor Material.mmItem IdColumn
Value of type 'System.Data.Da taColumn' cannot be converted to 'String'.

Can anyone help me out here? Thanks.
Jul 21 '05 #1
2 1741
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..jwaon line..com
-----------------------------------------------------------------------
"Wishing I was skiing mom" <Wi************ ******@discussi ons.microsoft.c om> wrote in message
news:B8******** *************** ***********@mic rosoft.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 = dgdMinorMateria l1.CurrentRowIn dex

I tried this code below, which looks good, but I receive the error message
that follows.
myForm1.ItemId = MinorMaterialDa taSet1.tblMinor Material.mmItem IdColumn
Value of type 'System.Data.Da taColumn' 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..jwaon line..com
-----------------------------------------------------------------------
"Wishing I was skiing mom" <Wi************ ******@discussi ons.microsoft.c om> wrote in message
news:B8******** *************** ***********@mic rosoft.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 = dgdMinorMateria l1.CurrentRowIn dex

I tried this code below, which looks good, but I receive the error message
that follows.
myForm1.ItemId = MinorMaterialDa taSet1.tblMinor Material.mmItem IdColumn
Value of type 'System.Data.Da taColumn' 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
9860
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 view/edit the values via the subform. I thought this would be accomplished using a simple loop; read values, assign the various fields of the subform & repeat for each row of the subform. Seems this is not possible, or at least I have been unable...
19
4117
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 the code that implements managing unbound controls on forms given the superior performance of unbound controls in a client/server environment. I can easily understand a newbie using bound controls or someone with a tight deadline. I guess I need...
2
9931
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 (multi-select without modifier keys). I got that working fine, but I also wanted to keep rows selected after a sort, which I do by storing the row's id in an arraylist. The idea was to do the sort and then go back and re-select the rows with that...
5
2042
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 one row, all of them were updated so i immediatelly figured out that i have to include the id of every entry in the update statement. This is where the problem is raised. My database is an Access database. The table i am updating contains a Date...
0
1172
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, I obtain a write lock. The datagrid is set to have a datasource of the datatable. The problem is that I get this error intermittently and it draws a big red X across my datagrid: ************** Exception Text **************...
3
3325
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", "Value" Depending on the "Locked" field in the source... I want the "Value" cell to be readonly or not for each row
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 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...
13
2463
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 works best) to display a dropdown menu of fields populated from table tblInvoiceData. This control also includes a textbox which the user can input a value. These two columns are side by side and not in a vertical layout. The user then clicks on...
0
10635
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10376
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10378
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10115
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9198
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7653
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5550
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4332
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.