Hi,

In my application I'm passing a dataset ByRef with the constructor of FormWeergaveZoek. There are also four buttons to scroll through the values of the dataset (ButtonVolgend, Buttonvorig, ButtonBegin, ButtonEinde). The fields of the dataset are displayed in textboxes with databindings. All the values are displayed correctly, except Me.TextBoxCDID.DataBindings.Add("text", dsMyDataset, "tblCD.CDID") which is displaying the number of the row in the dataset and not the original number in the database. For exmple :

In my database a CD from The Stones has CDID 234, but in the dataset (datasetzoeken12) this record is in the first row (because this is the searchresult). So the displayed result in the textbox will be 1 and not the required 234.

Why is this????

The code of the form is the following:


Public Class FormWeergaveZoek
Inherits Windows.Forms.Form
#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

Dim dsMyDataset As DataSet
Public Sub New(ByRef Datasetzoeken12 As DataSet)
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call
dsMyDataset = Datasetzoeken12
End Sub


Private Sub FormWeergaveZoek_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.TextBoxCDID.DataBindings.Add("text", dsMyDataset, "tblCD.CDID")
Me.TextBoxCDDetail.DataBindings.Add("text", dsMyDataset, "tblCD.CD")
Me.TextBox1.DataBindings.Add("text", dsMyDataset, "tblCD.programgroup")
Me.TextBoxCDdetailDescription.DataBindings.Add("text", dsMyDataset, "tblCD.DescriptionCD")
Me.TextBoxDatum.DataBindings.Add("text", dsMyDataset, "tblCD.date")
Me.CheckBoxActief.DataBindings.Add("text", dsMyDataset, "tblCD.active")
Me.LabelNumber.Text = (Me.BindingContext(dsMyDataset).Position + 1).ToString & " of " & Me.BindingContext(dsMyDataset, "tblCD").Count.ToString
End Sub

Private Sub ButtonVolgend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonVolgend.Click
Me.BindingContext(dsMyDataset, "tblCD").Position = (Me.BindingContext(dsMyDataset, "tblCD").Position + 1)
Me.LabelNumber.Text = (Me.BindingContext(dsMyDataset, "tblCD").Position + 1).ToString & " of " & Me.BindingContext(dsMyDataset, "tblCD").Count.ToString
End Sub

Private Sub ButtonVorig_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonVorig.Click
Me.BindingContext(dsMyDataset, "tblCD").Position = Me.BindingContext(dsMyDataset, "tblCD").Position - 1
Me.LabelNumber.Text = (Me.BindingContext(dsMyDataset, "tblCD").Position - 1).ToString & " of " & Me.BindingContext(dsMyDataset, "tblCD").Count.ToString
End Sub


Private Sub ButtonEinde_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonEinde.Click
Me.BindingContext(dsMyDataset, "tblCD").Position = Me.BindingContext(dsMyDataset, "tblCD").Count
Me.LabelNumber.Text = (Me.BindingContext(dsMyDataset, "tblCD").Count).ToString & " of " & Me.BindingContext(dsMyDataset, "tblCD").Count.ToString
End Sub

Private Sub Buttonbegin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buttonbegin.Click
Me.BindingContext(dsMyDataset, "tblCD").Position = 1
Me.LabelNumber.Text = "1 of " & Me.BindingContext(dsMyDataset, "tblCD").Count.ToString
End Sub
End Class




Thank you for your time.


Tom