datasets

G

Guest

Im running Vb.net 2003 and SQL2005

I manage to create a DataSet ( Client_RS ) and bind the data to the
textboxes,
I know there are about 450 records ( rows ) returned in the dataset but when
i
try to navigate through it row by row the display data for strLicence.text,
does not change

Im trying to produce a data input / amend screen where users can add and
update records, but all the examples i have found seen to only relate to
datagrids

Can Anybody give me any pointers?


Private Client_RS As New DataSet

' Load the DataSet with the client admin recordset
Private Sub LoadDataSet()
' Try to retrieve the records
Try
Client_RS = GetSQLDataSet("EXEC Bossdata.dbo.SQL2005_ADMINRS")
Try
LoadControls(0)
Catch ex As Exception
' Put In error trapping Here
' Temporary Message
MsgBox("Error Seeking 1st Record " & ex.Message)
' End Temporary Message
End Try
BindControls()
Catch ex As Exception
' Put In error trapping Here
' Temporary Message
MsgBox("Error Generating Recordset " & ex.Message)
' End Temporary Message
End Try
End Sub

' Navigation controls
Private Sub RS_Navagate(ByVal CURRENT_ROW As Integer, ByVal Directon As
Integer)
Const NEXTRECORD As Integer = 0
Const PREVIOUSRECORD As Integer = 1
Const FIRSTRECORD As Integer = 2
Const LASTRECORD As Integer = 3
Select Case Directon
Case NEXTRECORD
If CURRENT_ROW <
Client_RS.Tables("TBL_ClientAdmin").Rows.Count - 1 Then
CURRENT_ROW += 1
End If
Case PREVIOUSRECORD
If CURRENT_ROW > 0 Then
CURRENT_ROW -= 1
End If
Case FIRSTRECORD
CURRENT_ROW = 0
Case LASTRECORD
CURRENT_ROW = Client_RS.Tables("TBL_ClientAdmin").Rows.Count
- 1
End Select
End Sub

Protected Sub BindControls()
strLicence.DataBindings.Add("text", Client_RS,
"TBL_ClientAdmin.Licence")
End Sub
 
G

Guest

Peter,

I don't see where you are using a currencymanager to navigate through the
dataset.

Here is one approach that might work for you:

In the declarations section of your form, create a currencymanager:

Dim Manager As CurrencyManager

In your binding subprocedure, assign the bindingcontext to the
currencymanager:

Protected Sub BindControls()
strLicence.DataBindings.Add("text", Client_RS,
"TBL_ClientAdmin.Licence")

Manager = Me.BindingContext(Client_RS, "TBL_ClientAdmin")
End Sub

Now, in your navigation routine, manipulate the Position property of the
currencymanager:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top