Avatar of taduh
taduhFlag for United States of America

asked on 

How to force indexchanged event when my dropdown list contains only one item

Hi Experts,

I have a drop-down list of banks that gets dynamically filled from an SQL table based on order number. It is therefore possible for the DDL to contain a single entry for a given order. Normally, when I select an entry in the drop down list, the indexchanged event causes an SQL query to run which populates a series of textboxes with related data about the selected entry.

My problem is this: When I have only one entry in the DDL, no matter how many times I click or double-click on it to select it, an indexchanged event is never triggered. How can I force an indexchanged event for this scenario, so that the bank's related data will be displayed?

Thanks,

taduh
.NET ProgrammingASP.NETVisual Basic Classic

Avatar of undefined
Last Comment
taduh
SOLUTION
Avatar of Jorge Paulino
Jorge Paulino
Flag of Portugal image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of taduh
taduh
Flag of United States of America image

ASKER

It won't allow me to.

I mean I use the following code, but immediately after it goes the assignment statement, if I look at the value in dropdownCustXBanks.SelectedIndex, it is equal to 0.

If dropdownCustXBanks.Items.Count = 1 Then
                dropdownCustXBanks.SelectedIndex = -1
End If
ASKER CERTIFIED SOLUTION
Avatar of taduh
taduh
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Visual Basic Classic
Visual Basic Classic

Visual Basic is Microsoft’s event-driven programming language and integrated development environment (IDE) for its Component Object Model (COM) programming model. It is relatively easy to learn and use because of its graphical development features and BASIC heritage. It has been replaced with VB.NET, and is very similar to VBA (Visual Basic for Applications), the programming language for the Microsoft Office product line.

165K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo