Hi everyone,

I am new to c# and have come across to this:


dataGridView[int a, int b].Value.ToString();

I understand that it takes the values of rows and turns them to string, but I cannot figure out the two integers. Are they the first and last rows respectively? What am I missing out?

Thanks very much.

Recommended Answers

All 4 Replies

You are in fact indexing the DataGridView by using that syntax.
In your case it says: Show the string of the Value in column a and row b. (column and row indexes are zero based, so column 0 would be the first column)

Thank you very much!

You have been very very helpful!

Thanks again:)

Glad to be of help.
I will give you one more tip: don't use the names a and b use something like c or ror better still coland row. Your code will become clearer and easier to follow.
Happy programming :)

Thanks for the advice. Logical and practical.

Thanks again :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.