2 Replies - 639 Views - Last Post: 30 March 2009 - 09:27 AM Rate Topic: -----

#1 tbenjamin  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 02-August 08

VS 2008 help please.

Post icon  Posted 29 March 2009 - 06:10 PM

I am trying to create a windows form application that displays data from an access database and navigates through records, displaying each field in a text box. I have done most of the DB stuff in design view. Such as the db connection, the data bindings, ect. I created this program in class using VS 2003 and had no problem. For some reason it's not working out with VS 2008. The first record is displayed fine, but I cannot see the records navigating. However I thing the position is moving because I have coded a message box for when the first record and last record are reached, an when attempting to navigate the records the message boxes are displayed at the apropriate times, but the data does not change. No errors are generating when compiling and running the app. Thanks in advance for any help.

Here is my code:

Public Class frmMain
	Dim currMgr As CurrencyManager


	Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
		' Loads data into the 'DsCompactDiscs.tblCompactDiscs' table.
		Me.TblCompactDiscsTableAdapter.Fill(Me.DsCompactDiscs.tblCompactDiscs)




		' Gets a reference to the CurrencyManager object.
		currMgr = Me.BindingContext(DsCompactDiscs, "tblCompactDiscs")

	End Sub

	Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click

		' Advance to the next record in the table or display message to the user if last record is reached.
		If currMgr.Position < (currMgr.Count - 1) Then
			currMgr.Position += 1
		Else
			MessageBox.Show("No More Records.", "System Message", MessageBoxButtons.OK, MessageBoxIcon.Information)

		End If

	End Sub

	Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click

		Me.Close()

	End Sub

	Private Sub btnPrev_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrev.Click

		' Move to the previous row in the table or display a message to the user if first record is reached.
		If currMgr.Position > 0 Then
			currMgr.Position -= 1
		Else
			MessageBox.Show("First Record Reached.", "System Message", MessageBoxButtons.OK, MessageBoxIcon.Information)

		End If
	End Sub



End Class


Attached File  CDInventoryss.bmp (421.93K)
Number of downloads: 42

Is This A Good Question/Topic? 0
  • +

Replies To: VS 2008 help please.

#2 MrWobbles  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 31
  • View blog
  • Posts: 328
  • Joined: 11-April 08

Re: VS 2008 help please.

Posted 30 March 2009 - 07:00 AM

I'm not sure if this is for an assignment, or whether you are doing it to learn. However, if you are allowed to use a BindingNavigator then that might make it easier on you iterating through your records.
Was This Post Helpful? 0
  • +
  • -

#3 tbenjamin  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 02-August 08

Re: VS 2008 help please.

Posted 30 March 2009 - 09:27 AM

View PostMrWobbles, on 30 Mar, 2009 - 06:00 AM, said:

I'm not sure if this is for an assignment, or whether you are doing it to learn. However, if you are allowed to use a BindingNavigator then that might make it easier on you iterating through your records.



Thank you for the reply. Use of a binding navigator is something that I hadn't thought of. However, my main purpose is wondering why this code will not work in VS 2008 when it worked perfectly in VS 2003. This was an old lab assignment, I'm just going through some old labs to brush up I guess you could say. Something else I was wondering as well...in vs 2003 you can just drag the db table onto the form and it creates a data adapter, this cannot be done in vs 2008 either. When you create the bindings to the textboxes, a dataset and table adapter are created. Does anyone know why this is?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1