Just finished typing this so I will post anyway to add some additional points.
Hi,
Firstly, when posting to the Forum you must always remember to post a full and clear explanation of what it is you are trying to do, what is not working and any exception messages that you may be getting so that we do not have to work it out for ourselves. The basic thing to remember is that the more that you help us to help you the better your changes of getting a clear answer first time round.
In your case, the reason that things are failing is due to this line of code:-
While (i <= ds.Tables(0).Rows.Count + 1)
The mistake here is that there is no DataRow at .Rows.Count+1 since the last data row exists at location .Rows.Count-1. Now that's solved, let me take some time to make a few other comments:-
1) When posting code, please use Code tags on the Advanced button rather than Quote tags. It makes things easier to read and keeps the code formatting.
2) Turn both Option Strict and Option Explicit ON now to make sure you declare your variable types correctly and you pick up any type conversion errors as you encounter them while you code. This can be done in Tools->Options from the main menu for all future projects and in the Compile Tab from Project->Properties on the main menu for the current project.
3) If you are going to be using a single Database Table in your project then you should always use a DataTable object and not a DataSet object.
4) Always remember to use descriptive names for your variable declarations. You will thank yourself for doing this one day since as your projects grow bigger you will soon lose track of what variables are supposed to be doing what.
5) When iterating a collection with a FIXED number of objects you should always use a For Loop and not a While Loop since a While loop should only ever be used when you do not know the number of elements to be returned from the loop.
6) Do you realise that you are overwriting the information in the TextBox on every iteration of the Loop? This should be set to multiline and using the AppendText method of the TextBox.
Finally then, here is an example of how this can be cleaned up a bit
(TextBox with Multiline set to True):-
Dim myConnection As New SqlConnection("Data Source=IANVAIO\SQLEXPRESS;Initial Catalog=NORTHWIND;Integrated Security=True")
Dim daEmployees As New SqlDataAdapter("Select * from Employees", myConnection)
Dim dtEmployees As New DataTable
daEmployees.Fill(dtEmployees)
For Each currentRow As DataRow In dtEmployees.Rows
txtList.AppendText(String.Format("The Field Value is {0}{1}", currentRow.Item(2).ToString, Environment.NewLine))
Next
Hope that helps.
Cheers,
Ian