473,396 Members | 1,804 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how to make one by one combo Box working?

Hi there

I have three comboBoxs
I need the first comboBox selected and fill the second comboBox, after
second comboBox selected, it will fill the last comboBox, When I use
selectedIndex change event, it happens before I select second comboBox,
because when I selected first one, it auto fill the second one and make the
selectedindexchanged event happen, how can I disable it untial I select
second comboBox?
how can I do to make this one working?
the code as follow

Thanks

Tony
Private Sub cmbLastName_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
cmbLastName.SelectedIndexChanged
Dim bl As New BusinessLogic
cmbFirstName.DataSource =
bl.FillClientsFirstNameInfo(cmbLastName.Text).Tabl es(0).DefaultView
cmbFirstName.DisplayMember = "ClientsFirstName"
cmbFirstName.ValueMember = "CustomerID"
End Sub

Private Sub cmbFirstName_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
cmbFirstName.SelectedIndexChanged
MessageBox.Show(cmbFirstName.SelectedValue.ToStrin g)
End Sub

Nov 20 '05 #1
3 1566
Tony,

I had a tough time reading your description, in any event you might want to
consider using a flag, a private boolean variable in the form (i.e.
InProcess)

Set the value to TRUE in the active combo boxes SelectedIndex event then
call the procedure to fill the second or third combo boxes then set the
value back to False. In the SelectedIndex Change event you should always
check to see if InProcess is True if so then exit the event.

Dan

"Tony Dong" <it****@hotmail.com> wrote in message
news:uo**************@TK2MSFTNGP10.phx.gbl...
Hi there

I have three comboBoxs
I need the first comboBox selected and fill the second comboBox, after
second comboBox selected, it will fill the last comboBox, When I use
selectedIndex change event, it happens before I select second comboBox,
because when I selected first one, it auto fill the second one and make the selectedindexchanged event happen, how can I disable it untial I select
second comboBox?
how can I do to make this one working?
the code as follow

Thanks

Tony
Private Sub cmbLastName_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
cmbLastName.SelectedIndexChanged
Dim bl As New BusinessLogic
cmbFirstName.DataSource =
bl.FillClientsFirstNameInfo(cmbLastName.Text).Tabl es(0).DefaultView
cmbFirstName.DisplayMember = "ClientsFirstName"
cmbFirstName.ValueMember = "CustomerID"
End Sub

Private Sub cmbFirstName_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
cmbFirstName.SelectedIndexChanged
MessageBox.Show(cmbFirstName.SelectedValue.ToStrin g)
End Sub

Nov 20 '05 #2
Hi Solex

Thanks for you to reply so quickly, I don't know why when I use databinding
function, this event happen everything and cause the problems, but when I
use comboBox.items.add, it was working fine. I will change the databind to
items.add function, may it will be easy.

anyway, thanks for your help
Tony

"solex" <so***@nowhere.com> wrote in message
news:e5*************@TK2MSFTNGP11.phx.gbl...
Tony,

I had a tough time reading your description, in any event you might want to consider using a flag, a private boolean variable in the form (i.e.
InProcess)

Set the value to TRUE in the active combo boxes SelectedIndex event then
call the procedure to fill the second or third combo boxes then set the
value back to False. In the SelectedIndex Change event you should always
check to see if InProcess is True if so then exit the event.

Dan

"Tony Dong" <it****@hotmail.com> wrote in message
news:uo**************@TK2MSFTNGP10.phx.gbl...
Hi there

I have three comboBoxs
I need the first comboBox selected and fill the second comboBox, after
second comboBox selected, it will fill the last comboBox, When I use
selectedIndex change event, it happens before I select second comboBox,
because when I selected first one, it auto fill the second one and make

the
selectedindexchanged event happen, how can I disable it untial I select
second comboBox?
how can I do to make this one working?
the code as follow

Thanks

Tony
Private Sub cmbLastName_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
cmbLastName.SelectedIndexChanged
Dim bl As New BusinessLogic
cmbFirstName.DataSource =
bl.FillClientsFirstNameInfo(cmbLastName.Text).Tabl es(0).DefaultView
cmbFirstName.DisplayMember = "ClientsFirstName"
cmbFirstName.ValueMember = "CustomerID"
End Sub

Private Sub cmbFirstName_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
cmbFirstName.SelectedIndexChanged
MessageBox.Show(cmbFirstName.SelectedValue.ToStrin g)
End Sub


Nov 20 '05 #3
Tony,

you might want to check this article:
http://www.bobpowell.net/ComboBinding.htm

Dan

"Tony Dong" <it****@hotmail.com> wrote in message
news:uA**************@TK2MSFTNGP12.phx.gbl...
Hi Solex

Thanks for you to reply so quickly, I don't know why when I use databinding function, this event happen everything and cause the problems, but when I
use comboBox.items.add, it was working fine. I will change the databind to
items.add function, may it will be easy.

anyway, thanks for your help
Tony

"solex" <so***@nowhere.com> wrote in message
news:e5*************@TK2MSFTNGP11.phx.gbl...
Tony,

I had a tough time reading your description, in any event you might want

to
consider using a flag, a private boolean variable in the form (i.e.
InProcess)

Set the value to TRUE in the active combo boxes SelectedIndex event then call the procedure to fill the second or third combo boxes then set the
value back to False. In the SelectedIndex Change event you should always check to see if InProcess is True if so then exit the event.

Dan

"Tony Dong" <it****@hotmail.com> wrote in message
news:uo**************@TK2MSFTNGP10.phx.gbl...
Hi there

I have three comboBoxs
I need the first comboBox selected and fill the second comboBox, after
second comboBox selected, it will fill the last comboBox, When I use
selectedIndex change event, it happens before I select second comboBox, because when I selected first one, it auto fill the second one and make
the
selectedindexchanged event happen, how can I disable it untial I

select second comboBox?
how can I do to make this one working?
the code as follow

Thanks

Tony
Private Sub cmbLastName_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
cmbLastName.SelectedIndexChanged
Dim bl As New BusinessLogic
cmbFirstName.DataSource =
bl.FillClientsFirstNameInfo(cmbLastName.Text).Tabl es(0).DefaultView
cmbFirstName.DisplayMember = "ClientsFirstName"
cmbFirstName.ValueMember = "CustomerID"
End Sub

Private Sub cmbFirstName_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
cmbFirstName.SelectedIndexChanged
MessageBox.Show(cmbFirstName.SelectedValue.ToStrin g)
End Sub



Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: visionstate | last post by:
Hi there, I am working on a form that uses 3 text boxes and 3 combo boxes. When any data is entered into any of these, I click a command button and this requeries a sub query in the form and...
3
by: John | last post by:
AC2007 I changed my combo's row source and then the autocomplete stopped working. The combo is two columns, bound to the first. First column is primary key (ID). Second column is a...
4
by: Dave | last post by:
I wasn't sure how to search for previous posts about this, it felt real specific. Ok so here's the database & problem: I have 4 combo boxes: cboServer, cboPolicy, cboDB, and cboApplication. ...
6
by: Dave | last post by:
I want to put the information that the user selects in my combo boxes into a subform that lies on the same form as the combo boxes. Thanks for your help already, Dave
1
by: Dave | last post by:
Hello all, First I'd like to apologize...This post was meant to be put in my previous post, but I tried many times without success to reply within my previous post. Now here goes... I have a...
2
by: Dev1 | last post by:
All- I'm new to this forum and i've been working with acces for about 2 days now. I have a form in which I have two combo boxes and depending on what is selected on the first dropdown the second...
7
kcdoell
by: kcdoell | last post by:
I have three tables: One for the Division location: tblDivision DivisionID = Autonumber DivisionName = Text One for the Working Region: tblWrkRegion
1
by: Tim | last post by:
I'm working on a form where a combo box gets its list of values from a table. That same table also contains some "default notes" in other fields. My task is simple, but I'm having a hard time...
4
WyvsEyeView
by: WyvsEyeView | last post by:
I am doing the very standard thing of filtering the contents of one combo box based on another combo box. I've done it many times, but always on a main form. Now I'm trying to do it on a datasheet...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.