Terry,
Not sure I'm following your logic, so it is hard to offer detailed help. However, maybe I can offer some bits of help that will keep you moving.
First, this paradigm really isn't going to do anything:
SwStockBO1.Clear()
SwStockBO1.Save()
Nothing will ever get saved. And if there were changes in the SwStockBO1, they'd be lost. Clear() removes all the rows in the underlying DataTable. Those rows drive if there is anything to save or not. A DataRow has a row state that indicates if it is dirty and how it is dirty (new, edited, deleted). When a Save() happens, it walks the rows and either adds, updates or deletes the rows. No rows to walk, nothing to do.
Because of this, the first part of your code never does
anything in the database, thus the second part (were you add the new rows) fails, because those first four records are never deleted.
So, for the first part if you did something like:
MessageBox.Show(SwStockBO1.Count.ToString, "Number in Stock BO")
Dim narray(4) As Integer
SwStockBO1.MoveFirst()
For i = 0 To 4
narray(i) = SwStockBO1.stock
SwStockBO1.DeleteCurrentRow(True)
SwStockBO1.MoveNext()
Next
MessageBox.Show(SwStockBO1.Count.ToString, "Number in Stock BO")
SwStockBO1.Save()
You'd walk the first four rows of the BO, cache the "stock" value in your narray, mark those four rows for deletion, then actually delete those rows from the database when Save is called (and they'd be removed from the BO then as well).
If you just want to loop through the entire BO and delete every thing, you could also do:
MessageBox.Show(SwStockBO1.Count.ToString, "Number in Stock BO")
Dim narray() As Integer
Dim stockCount As Integer = SwStockBO1.Count
Redim narray(stockCount -1)
SwStockBO1.MoveFirst()
For i As Integer = 0 To stockCount -1
narray(i) = SwStockBO1.stock
SwStockBO1.DeleteCurrentRow(True)
SwStockBO1.MoveNext()
Next
' This will report number of records in BO (nothing removed yet)
MessageBox.Show(SwStockBO1.Count.ToString, "Number in Stock BO")
SwStockBO1.Save()
' After save, the BO will be empty and count should be zero
MessageBox.Show(SwStockBO1.Count.ToString, "Number in Stock BO")
Here I'm just using the count of the BO to drive the size of the array and the loop.
I just typed this in, so there might be some errors, but hopefully it helps you understand what is going on and gets you moving! Good luck!