Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Example of Combo Box Selection
Message
De
15/11/2004 16:24:32
 
 
À
15/11/2004 16:01:23
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
00951713
Message ID:
00961534
Vues:
10
Joe,

You're welcome! I'm glad I could help.

I *do* have one comment on your solution though ... the fact that you are getting new data for your form in the ComboBox's SelectedValueChanged event ... this is probably not a good idea, as this event will fire even if the user is just down-arrowing through the Combo list. You might be better off putting this code in the Combo's Validated event.

~~Bonnie



>Bonnie, Your information was quite useful and accurate, THANKS!
>
>I have kicked this around enough to have a very workable solution.
>The key was that it seems you have a navigation decision to make depending how you populate the business object and it's dataset that are used by the form in MM.NET for binding.
>
>1. Use a VCR like way of moving from record to record (implies filling the dataset with all records)
>2. Use a selection mechanism like a combo box (implies only filling the dataset with the combo box.value record).
>
>I would be very interested to know if there would be any other solutions but for my specific situation here is what was successful:
>
>
>    Private Sub ProcessingBatchesForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
>        ' Set the data source of the selection combo box to the business objects selection listing method results
>        ' This dataset is NOT automatically synchronized with the Form's data source (the business object)
>        Me.cboProcessingBatchSelection.DataSource = Me.oProcessingBatch.GetProcessingBatchSelectionListing()
>        Me.cboProcessingBatchSelection.Value = Me.oProcessingBatch.GetProcessingBatchMostRecentBatchId()
>
>        ' Configure the combo box display and values memeber to match that of the business object
>        Me.cboProcessingBatchSelection.DisplayMember = Me.oProcessingBatch.DescriptionField()
>        Me.cboProcessingBatchSelection.ValueMember = Me.oProcessingBatch.PrimaryKey()
>
>        ' Fill the data source of the form with the data for the record selected in the combo box
>        Me.oProcessingBatch.GetProcessingBatchByBatchId(CInt(Me.cboProcessingBatchSelection.Value))
>        Me.dsProcessingBatch = Me.oProcessingBatch.GetProcessingBatchByBatchId(CInt(Me.cboProcessingBatchSelection.Value))
>    End Sub
>
>    Private Sub cboProcessingBatchSelection_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboProcessingBatchSelection.ValueChanged
>        ' Fill the data source of the form with the data for the record selected in the combo box
>        Me.dsProcessingBatch = Me.oProcessingBatch.GetProcessingBatchByBatchId(CInt(Me.cboProcessingBatchSelection.Value))
>    End Sub
>
>
>
>MANY THANKS for the helpful ideas -- please feel free to share more (especially if my method is way off base or will have other limiting problems that I am not aware of)
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform