如何为每个循环获取datarow对象的行号

时间:2015-04-28 18:38:25

标签: vb.net datatable datarow

我正在使用vb.net 2013 我正在循环 - 下一个声明 这里dt是数据表

/*
    Prevent the email sending step for specific form
*/
add_action("wpcf7_before_send_mail", "wpcf7_do_something_else");  
function wpcf7_do_something_else($cf7) {
    // get the contact form object
    $wpcf = WPCF7_ContactForm::get_current();

    // if you wanna check the ID of the Form $wpcf->id

    if (/*Perform check here*/) {
        // If you want to skip mailing the data, you can do it...  
        $wpcf->skip_mail = true;    
    }

    return $wpcf;
}

任何帮助将不胜感激 感谢

2 个答案:

答案 0 :(得分:1)

不同循环:

    For rowNum = 0 To dt.Rows.Count - 1
        dt(rowNum - 1)(0) = 50
    Next

答案 1 :(得分:1)

总有一个好的旧索引变量:

Dim row_number as integer = 0
For Each dr As DataRow In dt.Rows

    ' here i want the row number (row_number) of the row being processed
    ' so that i can update some values in the previous row of datatable dt
    ' something like 

    dt(row_number-1)(0) = 50
    row_number += 1
Next
相关问题