?
Solved

C# and Return Datagrid Column Value

Posted on 2008-06-23
5
Medium Priority
?
507 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

777 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