Synching DataGridView with businessBindingSource BO


Author
Message
Mark Dowlearn
Mark Dowlearn
StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)
Group: Forum Members
Posts: 34, Visits: 9.9K
Hello -

I know I'm missing something simple here, but I'm new to working with both Strataframe and DataGridView objects.

I'm setting up a maintenance form for a table.  BO created, businessBindingSource mapped to the BO, DataGridView dataSource set to the businessBindingSource.

DataGridView is filled in ParentFormLoading () of the BO; data is displaying successfully. 

I'm able to sync the display of the BO to the DataGridView using the Navigate() method in the DataGridView's cellClick method().

What I'm not able to do is have the grid update to reflect the navigation that takes place when using the MaintenanceFormToolStrip on the maintenance form.  I know that the current record in the BO is available through the NavigatedEventArgs on the BO, but I'm unable to find the correct property to set or the correct method to call to set the DataGridView's pointer to the current index and then refresh the display.

I'm sure I'm missing something simple, but I'm stumped.  Any suggestions?

Mark

StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Most grids have a property such as SyncToCurrencyManager or something like that that tells the grid to stay in sync with the ICurrencyManager.Position, which is set by the navigate methods.  There was a problem with the grid matching the position of the business object when the business object was navigated, but it was fixed some time ago, so I don't think that's your issue. 
Mark Dowlearn
Mark Dowlearn
StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)
Group: Forum Members
Posts: 34, Visits: 9.9K
Ben -

This is just a plain vanilla Microsoft DataGridView -- I don't see any property listed as SyncToCurrencyManager or something similar.  Any other suggestions?

Yours,

m

Mark Dowlearn
Mark Dowlearn
StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)
Group: Forum Members
Posts: 34, Visits: 9.9K
OK -- I believe I've got it going after doing further research on CurrencyManager and BindingContext.  Thanks for the hint in this direction.

For the benefit of anyone else who might need to do this, In order to sync the grid with the BO (and other controls bound to the BO), I set the CurrencyManager.Position property to the CurrentRowIndex of the NavigatedEventArgs object in response to the Navigated() event:

CurrencyManager currencyManager = (CurrencyManager)this.dataGridView1.BindingContext[businessBindingSource1];

if (currencyManager != null)

{

currencyManager.Position = e.CurrentRowIndex;

}


StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
It's weird that it wouldn't be working for you automatically... because that's exactly what the BBS does internally...

Private Sub BusinessObject_Navigated(ByVal e As NavigatedEventArgs)

'-- Make sure we're not changing the position

If Not Me._ChangingPosition Then

Me._ChangingPosition = True

'-- Change the currencymanager's position

If Me.ICurrencyManagerProvider_CurrencyManager IsNot Nothing Then

Me.ICurrencyManagerProvider_CurrencyManager.Position = e.CurrentRowIndex

End If

Me._ChangingPosition = False

End If

End Sub


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search