[c#] Get Value of Row in Datatable c#

i have a problem with my code.

foreach (DataRow dr in dt_pattern.Rows)
    {
      part = dr["patternString"].ToString();
      if (part != vpart)
      {
        System.Console.WriteLine(part);
        System.Console.WriteLine("Geben Sie bitte für den Abschnitt die AT ein: ");
        temp = System.Console.ReadLine();
        AT = ToDouble(temp);
        dr["AT"] = AT;

        double xATmax = ToDouble(dr["Ampl"].ToString());
        double x = ToDouble(dr["Time"].ToString());

        double yATmax = ToDouble(dr["Ampl"]+1.ToString()) + AT;
        double y = ToDouble(dr["Ampl"].ToString());

        dr["alphaATmin"] = Gradient(x,xATmax,y,yATmax);
        System.Console.WriteLine(dr["alphaATmin"]);
      }
      vpart = part;          
    }

but i need at xATmax and yATmax the Value of the next Row... Someone can help me ?

This question is related to c# datatable gradient datarow

The answer is


for (Int32 i = 1; i < dt_pattern.Rows.Count - 1; i++){ double yATmax = ToDouble(dt_pattern.Rows[i]["Ampl"].ToString()) + AT; }

if you want to get around the + 1 issue


for (int i=0; i<dt_pattern.Rows.Count; i++)
{
    DataRow dr = dt_pattern.Rows[i];
}

In the loop, you can now reference row i+1 (assuming there is an i+1)


Examples related to c#

How can I convert this one line of ActionScript to C#? Microsoft Advertising SDK doesn't deliverer ads How to use a global array in C#? How to correctly write async method? C# - insert values from file into two arrays Uploading into folder in FTP? Are these methods thread safe? dotnet ef not found in .NET Core 3 HTTP Error 500.30 - ANCM In-Process Start Failure Best way to "push" into C# array

Examples related to datatable

Can't bind to 'dataSource' since it isn't a known property of 'table' How to get a specific column value from a DataTable in c# Change Row background color based on cell value DataTable How to bind DataTable to Datagrid Find row in datatable with specific id Datatable to html Table How to Edit a row in the datatable How do I use SELECT GROUP BY in DataTable.Select(Expression)? How to fill a datatable with List<T> SqlBulkCopy - The given value of type String from the data source cannot be converted to type money of the specified target column

Examples related to gradient

Gradient text color Use css gradient over background image SVG gradient using CSS How to make gradient background in android Gradient of n colors ranging from color 1 and color 2 Use CSS3 transitions with gradient backgrounds Android LinearLayout Gradient Background Multi-gradient shapes Gradients in Internet Explorer 9 CSS3 gradient background set on body doesn't stretch but instead repeats?

Examples related to datarow

Find row in datatable with specific id DataColumn Name from DataRow (not DataTable) How to add new DataRow into DataTable? Simple way to copy or clone a DataRow? get index of DataTable column with name Getting datarow values into a string? DataRow: Select cell value by a given column name Check if DataRow exists by column name in c#? How do I get column names to print in this C# program? C# DataRow Empty-check