CSharp: How to fix following C# error in Visual Studio: Cannot apply indexing with [] to an expression of type 'System.Data.DataTable'

Error:
Cannot apply indexing with [] to an expression of type 'System.Data.DataTable'

Cause:
string variable = Table[0][1].ToString();

Solution:
DataTable Table;string variable = Table.Rows[index][column-index].ToString();

Example:

DataTable Table;
string variable = Table.Rows[0][1].ToString();

The above error happens when you try to index the datatable without first accessing the "Rows" property. You must first access the "Rows" property and then provide the index.

Hiç yorum yok:

Visual Studio 2017'de Devexpress 17.2.5 Toolbox görünmüyor

Visual Studio 2017 Toolbox'ı üzerinde Developer Express componentlerini göremiyorsanız aşağıdaki komutu çalıştırmak işini görecektir. (...