Click here to Skip to main content
15,888,286 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# Pin
Keith Barrow11-Sep-13 2:20
professionalKeith Barrow11-Sep-13 2:20 
GeneralRe: C# Pin
Member 1026649411-Sep-13 1:34
Member 1026649411-Sep-13 1:34 
QuestionlistViewNV_KeyPress function it does not run ? Pin
Member 245846710-Sep-13 22:51
Member 245846710-Sep-13 22:51 
AnswerRe: listViewNV_KeyPress function it does not run ? Pin
Richard MacCutchan10-Sep-13 23:04
mveRichard MacCutchan10-Sep-13 23:04 
Questionhow can I access to a DGV column contents? Pin
babak1410-Sep-13 20:59
babak1410-Sep-13 20:59 
AnswerRe: how can I access to a DGV column contents? Pin
OriginalGriff10-Sep-13 21:49
mveOriginalGriff10-Sep-13 21:49 
GeneralRe: how can I access to a DGV column contents? Pin
babak1410-Sep-13 22:47
babak1410-Sep-13 22:47 
GeneralRe: how can I access to a DGV column contents? Pin
OriginalGriff10-Sep-13 23:10
mveOriginalGriff10-Sep-13 23:10 
You really shouldn't need more details, but...
Lets just look at your questions in reverse order:

babak14 wrote:
can you write it for me?

Yes, I could. But then I'd have to send you a pro-forma invoice first, and I don't think you want to pay my rates...


babak14 wrote:
how can I apply your solution in my code?

That's really down to you: I don't have an exact idea what you are trying to do, so I can't be very specific.


babak14 wrote:
can you explain more in details? because I am beginner

This is the main reason I'm not giving you code: we don't don't do homework, and it isn't good for you to just be given a solution. You learn more by doing it yourself!

But... this might help:
Data organisation in a DataGridView (DGV for short)

Property: DataGridView.Columns
Contains a collection of DataGridViewColumn objects, each of which describes the column - the header, the column data source and so on. This does not contain any actual values displayed in the DGV.


Property: DataGridView.Rows
Contains a collection of DataGridViewRow objects, each of which holds a collection of cells, each of which corresponds to the value for that row within a column.


Property: DataGridViewRow.Cells
Contains a collection of DataGridViewCell objects, each of which holds a value for the column.



So to get all the values you loop through each row, then access the cells for that row:
(this code won't help you much in practice - it's not something we would actually do in the real world but it should demo what I mean:
C#
foreach (DataGridViewRow row in myDataGridView.Rows)
    {
    foreach (DataGridViewCell cell in row.Cells)
        {
        Console.Write("{0} ", cell.Value);
        }
    Console.WriteLine();
    }


Run the code, and you should get the idea.
This message is manufactured from fully recyclable noughts and ones. To recycle this message, please separate into two tidy piles, and take them to your nearest local recycling centre.
Please note that in some areas noughts are always replaced with zeros by law, and many facilities cannot recycle zeroes - in this case, please bury them in your back garden and water frequently.

GeneralRe: how can I access to a DGV column contents? Pin
babak1411-Sep-13 1:29
babak1411-Sep-13 1:29 
GeneralRe: how can I access to a DGV column contents? Pin
OriginalGriff11-Sep-13 2:23
mveOriginalGriff11-Sep-13 2:23 
Questiondisplay loading processes on SplashScreen Pin
Jassim Rahma10-Sep-13 10:15
Jassim Rahma10-Sep-13 10:15 
AnswerRe: display loading processes on SplashScreen Pin
SledgeHammer0110-Sep-13 10:26
SledgeHammer0110-Sep-13 10:26 
AnswerRe: display loading processes on SplashScreen Pin
Mycroft Holmes10-Sep-13 15:00
professionalMycroft Holmes10-Sep-13 15:00 
QuestionHow can I solve this error : " Provided column already belongs to the DataGridView control" Pin
babak1410-Sep-13 7:14
babak1410-Sep-13 7:14 
AnswerRe: How can I solve this error : " Provided column already belongs to the DataGridView control" Pin
Richard Deeming10-Sep-13 7:22
mveRichard Deeming10-Sep-13 7:22 
GeneralRe: How can I solve this error : " Provided column already belongs to the DataGridView control" Pin
babak1410-Sep-13 8:03
babak1410-Sep-13 8:03 
GeneralRe: How can I solve this error : " Provided column already belongs to the DataGridView control" Pin
babak1410-Sep-13 8:16
babak1410-Sep-13 8:16 
QuestionMessageBox with textbox WPF Pin
juliogyn10-Sep-13 3:57
juliogyn10-Sep-13 3:57 
AnswerRe: MessageBox with textbox WPF Pin
Richard MacCutchan10-Sep-13 5:17
mveRichard MacCutchan10-Sep-13 5:17 
QuestionTake the first day of the month and the last day of the month ? Pin
Member 24584679-Sep-13 22:59
Member 24584679-Sep-13 22:59 
AnswerRe: Take the first day of the month and the last day of the month ? Pin
Richard MacCutchan9-Sep-13 23:43
mveRichard MacCutchan9-Sep-13 23:43 
GeneralRe: Take the first day of the month and the last day of the month ? Pin
Pete O'Hanlon10-Sep-13 0:44
mvePete O'Hanlon10-Sep-13 0:44 
AnswerRe: Take the first day of the month and the last day of the month ? Pin
Pete O'Hanlon10-Sep-13 0:38
mvePete O'Hanlon10-Sep-13 0:38 
AnswerRe: Take the first day of the month and the last day of the month ? Pin
Pete O'Hanlon10-Sep-13 2:22
mvePete O'Hanlon10-Sep-13 2:22 
AnswerRe: Take the first day of the month and the last day of the month ? Pin
ExcellentOrg10-Sep-13 5:27
ExcellentOrg10-Sep-13 5:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.