Hi all,

i have a function which opens a new screen and tries to search through the dataset to find a specific record. The form opens but it hangs, what am i doing wrong?

VB Code:
  1. Public Function Add_New()
  2.  
  3.         Dim frmNS As New frmNS
  4.         frmNS.Show()
  5.  
  6.         Try
  7.             Do While frmNS.objdsCDets_SDets.CDets(0).CHD_ID() <> sv
  8.                 frmNS.BindingContext(frmNS.objdsCDets_SDets, "ChD").Position = (frmNS.BindingContext(frmNS.objdsCDets_SDets, "ChD").Position + 1)
  9.             Loop
  10.  
  11.         Catch ex As Exception
  12.             MsgBox("Error", MsgBoxStyle.OKOnly)
  13.         End Try
  14.  
  15. End Function
  16.  
  17. 'where sv contains the pk from the previous form

Cheers