Resolved Using Cell 7n C# with value like in Vb

Rabi

Member
Joined
Mar 22, 2022
Messages
17
Programming Experience
Beginner
I was using vb and i try to convert my code to C#. I tried this codes
VB
DataGridView1.CurrentRow.Cells(3).Value

C#
dataGridView1.CurrentRow.Cells...
did not complete the code like VB with index number with cell.
How can I do this
 
Solution
Where you use parentheses to index a collection in VB, you use brackets in C#. Parentheses are only for method calls.
C#:
DataGridView1.CurrentRow.Cells[3].Value
I've been coding in C# for years but, as someone who uses both, I still make that mistake fairly regularly.
Where you use parentheses to index a collection in VB, you use brackets in C#. Parentheses are only for method calls.
C#:
DataGridView1.CurrentRow.Cells[3].Value
I've been coding in C# for years but, as someone who uses both, I still make that mistake fairly regularly.
 
Solution
Out of curiosity, what does "7n" stand for?
 
Back
Top Bottom