By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,905 Members | 1,616 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,905 IT Pros & Developers. It's quick & easy.

Database Records Represantation Problem ? ? ?

P: n/a
Hello all . . .
I'm using the Microsoft Visual Studio 2005 Pro.

I have create an application (my first one) and i connected to
Northwind database thru MS SQL Server.

Then i used some text fields to my form and i was bind some fields to
them from the database.

When the application starts everythink look ok.

In my next step i put a button to move to the next record.

I start again the application and i try to use the button but nothing
hapens . . .

The only change is the posiion of the "header" in the database. I use
the Label3 to desplay the header position.

Why ? ? ?

THIS IS THE CODE OF MY FORM

Public Class Form1

Private Sub CustomersBindingNavigatorSaveItem_Click(ByVal sender
As System.Object, ByVal e As System.EventArgs)
Me.Validate()
Me.CustomersBindingSource.EndEdit()
Me.CustomersTableAdapter.Update(Me.NorthwindDataSe t.Customers)

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the
'NorthwindDataSet.Customers' table. You can move, or remove it, as
needed.
Me.CustomersTableAdapter.Fill(Me.NorthwindDataSet. Customers)
Me.Label3.Text = Me.BindingContext(Me.NorthwindDataSet,
"Customers").Position
End Sub

Private Sub CustomersBindingSource_CurrentChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
CustomersBindingSource.CurrentChanged

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
Me.BindingContext(Me.NorthwindDataSet, "Customers").Position =
Me.BindingContext(Me.NorthwindDataSet, "Customers").Position + 1
Me.BindingContext(Me.NorthwindDataSet,
"Customers").EndCurrentEdit()
Call PositionChanged()
End Sub

Private Sub PositionChanged()
Me.Label3.Text = ((Me.BindingContext(Me.NorthwindDataSet,
"Customers").Position + 1).ToString & " / " &
Me.BindingContext(Me.NorthwindDataSet, "Customers").Count.ToString)
End Sub

Private Sub CustomersBindingSource1_CurrentChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
CustomersBindingSource1.CurrentChanged

End Sub
End Class
Thanks . . . :D

Mar 15 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
You don't need to post your questions more than once. :-)
Robin S.
---------------------------
"CorfuVBProgrammer" <me***********@gmail.comwrote in message
news:11**********************@y66g2000hsf.googlegr oups.com...
Hello all . . .
I'm using the Microsoft Visual Studio 2005 Pro.

I have create an application (my first one) and i connected to
Northwind database thru MS SQL Server.

Then i used some text fields to my form and i was bind some fields to
them from the database.

When the application starts everythink look ok.

In my next step i put a button to move to the next record.

I start again the application and i try to use the button but nothing
hapens . . .

The only change is the posiion of the "header" in the database. I use
the Label3 to desplay the header position.

Why ? ? ?

THIS IS THE CODE OF MY FORM

Public Class Form1

Private Sub CustomersBindingNavigatorSaveItem_Click(ByVal sender
As System.Object, ByVal e As System.EventArgs)
Me.Validate()
Me.CustomersBindingSource.EndEdit()
Me.CustomersTableAdapter.Update(Me.NorthwindDataSe t.Customers)

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the
'NorthwindDataSet.Customers' table. You can move, or remove it, as
needed.
Me.CustomersTableAdapter.Fill(Me.NorthwindDataSet. Customers)
Me.Label3.Text = Me.BindingContext(Me.NorthwindDataSet,
"Customers").Position
End Sub

Private Sub CustomersBindingSource_CurrentChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
CustomersBindingSource.CurrentChanged

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
Me.BindingContext(Me.NorthwindDataSet, "Customers").Position =
Me.BindingContext(Me.NorthwindDataSet, "Customers").Position + 1
Me.BindingContext(Me.NorthwindDataSet,
"Customers").EndCurrentEdit()
Call PositionChanged()
End Sub

Private Sub PositionChanged()
Me.Label3.Text = ((Me.BindingContext(Me.NorthwindDataSet,
"Customers").Position + 1).ToString & " / " &
Me.BindingContext(Me.NorthwindDataSet, "Customers").Count.ToString)
End Sub

Private Sub CustomersBindingSource1_CurrentChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
CustomersBindingSource1.CurrentChanged

End Sub
End Class
Thanks . . . :D

Mar 16 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.