Solved

C# and Return Datagrid Column Value

Posted on 2008-06-23
5
490 Views
Last Modified: 2013-11-26
I have a Datagrid - dgSearchResults
I would like to return the value in the first column, MORTGEE_NUMBER

How can I do this via code?

Thanks,

JD
0
Comment
Question by:jamesdean666
  • 3
  • 2
5 Comments
 
LVL 16

Expert Comment

by:burakiewicz
ID: 21848308
dgSearchResults.Rows[x].Cells[0].Value

0
 
LVL 16

Expert Comment

by:burakiewicz
ID: 21848397
or do you need all of the values from the column
0
 

Author Comment

by:jamesdean666
ID: 21848528
Just one column in the row, which will be selected in the datagrid.
0
 
LVL 16

Accepted Solution

by:
burakiewicz earned 500 total points
ID: 21848615
these should work then
dgSearchResults.SelectedRows[0].Cells[0].Value;  
or
dgSearchResults.Rows[dgSearchResults.SelectedRows[0].Index].Cells[0].Value;
you can also use the column name

dgSearchResults.SelectedRows[0].Cells["MORTGEE_NUMBER"].Value;  
or
dgSearchResults.Rows[dgSearchResults.SelectedRows[0].Index].Cells["MORTGEE_NUMBER"].Value;
0
 

Author Closing Comment

by:jamesdean666
ID: 31469854
Thanks.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now