473,779 Members | 2,035 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do you access the value of a cell in a Windows form datagrid?

How do you access the value of a cell in a Windows form datagrid?

I know this is how you would do it using an ASP.NET datagrid:
DataGrid1.Items[1].Cells[1].Text

However, "Items" is not available in the Windows Forms datagrid.

Thanks,

Paul

Jul 21 '05 #1
2 1551
You access it by using the indexer like the follwoing code snippet:

DataGrid dg = new DataGrid();
object cellValue = dg[1,1];

I hope this helps.

Jon

"Paul Daly (MCP)" <Pa*********@di scussions.micro soft.com> wrote in message
news:15******** *************** ***********@mic rosoft.com...
How do you access the value of a cell in a Windows form datagrid?

I know this is how you would do it using an ASP.NET datagrid:
DataGrid1.Items[1].Cells[1].Text

However, "Items" is not available in the Windows Forms datagrid.

Thanks,

Paul

Jul 21 '05 #2
Thanks! That worked!

- Paul

"CodeMeiste r" wrote:
You access it by using the indexer like the follwoing code snippet:

DataGrid dg = new DataGrid();
object cellValue = dg[1,1];

I hope this helps.

Jon

"Paul Daly (MCP)" <Pa*********@di scussions.micro soft.com> wrote in message
news:15******** *************** ***********@mic rosoft.com...
How do you access the value of a cell in a Windows form datagrid?

I know this is how you would do it using an ASP.NET datagrid:
DataGrid1.Items[1].Cells[1].Text

However, "Items" is not available in the Windows Forms datagrid.

Thanks,

Paul


Jul 21 '05 #3

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

Similar topics

0
1581
by: Shravan | last post by:
Hi, I have a extended datagrid, in which I am setting values at a given cell in the grid using grid = val; The grid has NewRow creation set to false But sometimes setting value at a existing row is adding newrow in the grid, which is staying temporarily and when
1
2927
by: Abareblue | last post by:
I have no clue on how to insert a record into access. here is the whole thing using System; using System.Drawing; using System.Collections; using System.ComponentModel;
5
1821
by: Jason | last post by:
I've been trying to figure out a good way to do this but haven't had much luck, any input would be greatly appreciated. Basically, after a datagrid is sorted, how can I get the primary key value of the item selected by the user? That is, not the datagrid index 'location' of the item the user selected, but the value inside a column of this item the user clicked on. I would use the CurrencyManager in a windows application but I'm not...
3
3406
by: Tracey | last post by:
sorry I post this problem again. I have to stop my work to fix the problem. I'm doing a multi form application(Not a MDI one). My startup form say Form1 has a datagrid say datagrid1, when I click a grid item in datagrid1, I wanna show form2. In my code, I achieved that with: Public class Form1 Inherits System.Windows.Forms.Form
1
2404
by: Tricia Colwell via DotNetMonster.com | last post by:
Here is what i have: I have a datagrid with two columns one is a combo box style and the other is a textbox style. If the combo box is "Between" or "Like" i want that the next cell to be readonly..which is the textbox one. How do i do this??? Tricia --
2
275
by: Paul Daly (MCP) | last post by:
How do you access the value of a cell in a Windows form datagrid? I know this is how you would do it using an ASP.NET datagrid: DataGrid1.Items.Cells.Text However, "Items" is not available in the Windows Forms datagrid. Thanks, Paul
2
2088
by: benfly08 | last post by:
Hi, everyone. I got a weird problem for my C# program. In my program, I use a DataGrid to display data. I bind the DataGrid to a DataTable. I made all the cells in DataGrid ReadOnly as True. So I can only Click on the cell but not change them. Now, after I display the data, I clicked on one cell, then I clicked a button which will *virtually* go to the other form.(The reason why I said *virtually* is because I only use one form for...
2
2943
by: =?Utf-8?B?TWlrZQ==?= | last post by:
Greetings, I am trying to find out how to do something that on the surface seems like it should be very simple to do. I have a datagrid with a datatable bound to it using the SetDataBinding method. What I am trying to accomplish is to detect if a value has changed in any cell so that if a user closes the form without saving first, I want to prompt to save changes. I don't want to prompt if there were no changes.
4
2112
by: _MC_ | last post by:
Hi, I'm unable to access values in my Datagrid. Datagrid thinks it hase only 1 Cell. So here it is: The Datagrid is binded in PageLoad, AutoGenerateColumns is false, Columns are added on PageLoad like this: BoundColumn Bound_Column = new BoundColumn(); Bound_Column.DataField = name; ( + HeaderText,
0
9632
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
9471
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
10136
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
10071
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
8958
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
7478
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
5501
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4036
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
3
2867
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.