Practising List Box

irresistible007

Board Regular
Joined
Nov 24, 2005
Messages
173
Okie... i am trying to polish my skills before i shall go ahead wid the project... here is the imaginery scenario...

Objective:To build a user interface capable of adding and deleting Country Names and their respective City Names.

Description:
A little program is being Built to store customer's Data. Since the company is having worldwide network of customers we have placed two Combo boxes one for each Country and City Name so as the user can select instead of typing it everytime. However a provision to edit the country and Cities list is necessary so there is a dedicated space allocated for this task where I have putted following controls:


Controls:
2 Text Boxes...1 Each for typing Country and City Names
2 List Boxes... 1 for showing Countries and 1 for showing the respective cities for the selected Country
4 Command Buttons ... 2 set of Add & remove

Problem:
Since i am a newbie, i am totally confused as how this sub-category thingy has to be done... I mean for instance if i have to add U.S.A. its pretty easy to type following block of code

Private Sub commandbutton1_Click()
Listbox1.additem textbox1.text
End Sub


But what if i want to add washigton cuz that has to be added as a sub iem of U.S.A i.e. only to be shown when U.S.A is selected... though i can simply add a huge block of If-Then but that will only work for preset items and if the user want to add another city then I will have to alter the If-Then block again
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

Forum statistics

Threads
1,214,830
Messages
6,121,839
Members
449,051
Latest member
excelquestion515

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top