Using Visual Studio/Coded UI - hand written to automate the web portal testing. ( I am new to vs)

scenario is :
1. Login
2. Search with different set of data.
3. Validate the data
4. Logout.

I had data in data.csv and defined the [DataSource] , so able to access the data in data.csv.
script is running correctly as designed.for each iteration, scripts logins , searches and logout.

Now I wanted to have all run in one login and logout.
I wanted to get the row count of the data source and use for loop and increment to next row and run all and logout at the end.
I know how to do that through UFT , just adding the UFT steps for what I want to achieve.

Dim nrq :nrq = objDataTable.GetRowCount()
While nrq > 0
nrq = nrq-1
i = i+1

If I get the stmts how to get the row count and set the row, I should be fine?

Thanks in advance.