Navigation

Posts   
 
    
PeterX
User
Posts: 8
Joined: 13-Jun-2005
# Posted on: 20-Jun-2005 18:27:23   

Want to set up VCR type navigation for form. I've created a typed list for the object and attached that to a datagrid. That works fine. Next step is to put one record on a form with fields bound to individual windows controls. Want first, next, previous, last navigation type structure. How do I implement this?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 20-Jun-2005 21:50:03   

I think if you fetch an entity collection with a couple of entities, you can bind entitycollection[index] to the field controls and control 'index' with the VCR controls. If you also display them in a grid, you can simply setup databinding between the entity collection and the field controls properties (like textbox.Text, using textbox.Databindings.Add(...)) so the current selected row is reflected in the textboxes. With the VCR controls you then manipulate the currency manager what the active row is.

Frans Bouma | Lead developer LLBLGen Pro
PeterX
User
Posts: 8
Joined: 13-Jun-2005
# Posted on: 21-Jun-2005 18:33:51   

Doing some further work on this. Beta 2 has a new control called BindingNavigator that should do most of the work of creating a VCR type control to move through records. Microsoft documentations says add BindingNavigator and BindingSource controls to the form and then use the following sample code:

' Load the Customers result set into the DataSet. Dim ds As New DataSet("Northwind Customers") ds.Load( _ reader, _ LoadOption.OverwriteRow, _ New String() {"Customers"})

' Assign the DataSet as the DataSource for the BindingSource. Me.customersBindingSource.DataSource = ds

' Bind the CompanyName field to the TextBox control. Me.companyNameTextBox.DataBindings.Add( _ New Binding( _ "Text", _ Me.customersBindingSource, _ "CompanyName", _ True))

Control then adds icons to screen and handles data navigation. Nice - if i can get it to work!

LLBLGen does not produce a dataset - so in trying to create one with the following code:

dim ds as DataSet=New DataSet ds.Tables.Add("Mortgages") BindingSource1.DataSource=ds editMortgageId.DataBindings.Add("Text", BindingSource1, "MortgageId")

Where Mortgages is a TypedView. Code compiles but fails on the last line where I says "Canot bind to the property or column "MortgageId" on the DataSource. Parameter name: dataMember". Any ideas of how I can make this work?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 22-Jun-2005 10:55:30   

You should be able to bind an entity collection, or doesn't that work in your situation? I can give it a try to see if it works here if you want.

Frans Bouma | Lead developer LLBLGen Pro
PeterX
User
Posts: 8
Joined: 13-Jun-2005
# Posted on: 28-Jun-2005 01:18:56   

Binding to an entity collection worked like a charm. Thanks.