473,659 Members | 2,996 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 1726
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
9851
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
4091
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
9920
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
2026
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
1166
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
3317
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
2445
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
8428
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8335
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8747
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...
0
7356
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
6179
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
4175
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...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2752
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
1976
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.