|
-
Mar 31st, 2006, 01:52 PM
#1
Thread Starter
New Member
[02/03] Default processing in form load event
In a combobox i have filled with data the "selectedindexChanged" event fires on form load.
VB Code:
Private Sub frmTest_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
datranstype.Fill(uscData.DsPersonalFinance.TransType)
cboTransType.DataSource = uscData.DsPersonalFinance
cboTransType.DisplayMember = "TransType.transType"
cboTransType.ValueMember = "TransType.transTypePK"
End Sub
Is there a reason for the selectedIndexChanged on that event to fire on form load? and is there a way to stop that event from firing, it is causing some problems.
Last edited by Sodapop; Mar 31st, 2006 at 04:09 PM.
-
Apr 5th, 2006, 09:50 PM
#2
Re: [02/03] Default processing in form load event
Setting the DataSource property triggers the SelectedIndexChanged event before you've set your ValueMember property.
Simply set the DataSource afterwards and you won't get an unexpected SelectedValue type
VB Code:
cboTransType.DisplayMember = "TransType.transType"
cboTransType.ValueMember = "TransType.transTypePK"
cboTransType.DataSource = uscData.DsPersonalFinance
Regards,
- Aaron.
-
Apr 11th, 2006, 10:02 AM
#3
Thread Starter
New Member
Re: [02/03] Default processing in form load event
Thanks Aaron, that worked and it fixed my problem.
Visual Studio .NET 2003/.NET Framework 1.1
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|