Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Example of Combo Box Selection
Message
De
15/11/2004 16:01:23
 
 
À
12/11/2004 11:27:31
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
00951713
Message ID:
00961522
Vues:
10
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)
THANKS
Joe Salvatore, Programmer/Analyst - The Stellar Group
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform