I have three listboxes in windowsform app. I want to display the countries, states, cities in respective three listboxes. But the states should be displayed according to the country selected and similarly for the cities.
Now the code may not seem an issue for two three countries, but what if I take a practical situation keeping in mind all countries of the world and their corresponding states and cities.
What will be the best way to implement this ?
Update--- I actually wanted to ask what data structures will be best for this ?
A 3d jagged array wiil work fine .nO ? or are there any better ways to do this ?
i have no idea how to do this . Can anyone code this ?
load all the countries into the first list. when the user selects a country clear the state/providence and city list boxes. load the cities for the select state/providence. when a state/providence is selected load the cities.
additional options:
have the user enter their postal code (assuming there are international code) and lookup up the city based on the code.
allow the user to enter this into free form text boxes instead of a predefined list.
require the user to enter the first N characters before populating the list with matching choices.
Generally a top down hierarchy is applied.
Bind the countries list (nothing else)
On country selection, bind/rebind the states list filtered for the country & clear the city list.
Finally on a state selection, bind/rebind the city dropdown.
Related
I'm trying to create a simple project, an Inventory management system.
We have a set of items for sale in our inventory (defined in the database) and we dispatch items in the quantity that the customer order.
The issue I have is, a user may order just 1 item, or they may order a 100 items, in whatever quantities they prefer (assume the user of this system gets this info through an email).
So I have some trouble creating the "Sales Order" GUI.
I tried using a ListBox / ListView. There I can select all the items they want and generate a sales order, but I can't enter the corresponding quantity.
It is not practical to have like 20 text boxes in the form.
If I understand your question correctly, it seems as if a good approach would be to have a means of selecting the specific product you want to quantify first. Supermarket POS systems do this through PLU (Price Look Up) codes that identify the product name and price. You could alternately have a search box that combs through your database for product names matching the search query.
After that you can have one text box (I would recommend a number spinner) to select the quantity.
Finally have a button that submits that order of that specific product and move on to the next. You could wait to submit all the quantities needed until the order is completed to signify that it is one unique order if that information is important to you.
I have to write a program to determine which students have a specified major based upon the button that is clicked. For example, if the Search Computer Science button is clicked, then the program should pull all the CS student's names and put them in the results List box. The text box above the results list box should contain the specified major being searched and the text box below should contain a message indicating the total number of students with that specific major. Can someone help me please? Not even sure where to start. Thank you!
I can't upload the picture of my form because of low reputation. but the form has 3 list boxes. The first list box (lstStudents) has all of the students' names. The second list box (lstMajors) is the majors each student belong in. So, the student in Items(0) of the lstStudents list box, is in the major at Items(0) of the lstMajors list box.
Not enough info to provide a proper answer, but this is what you need to do:
When a button is clicked, you need to get the major.
Then you need to iterate through all the options in the Majors listbox, and if it matches the major in step 1, then copy/move the student in the students listbox that is at the same position, into the results listbox.
Set the value of the top textbox to the major you determined in step 1.
Set the value of the bottom textbox the the number of students in the results listbox.
Make sense?
Good luck with your assignment!
i have a winform C# app that retrieves values from a sql server and has to store in the checkbox as text value. the user will check on the checkbox and save the corresponding value back to the table(This part is later on.)..
here is how my form looks like.
Now, say for example, in my table it holds 12 subject e.g sub1, sub2...sub12.
there is no distinction in the table as to which subject belongs to which semester.
herein lies my problem, i want to be able to get the subjects say for sem 1 and only display in the first 4 checkboxes, suppose there are subjects from sem 2 show them in the checkboxes in the fourth panel.
i know i have to compare manually all the values, if they contain words like"sub1" if yes the check a checkbox. but there are too many variables here....
is there any way to solve my problem ?
I am creating a staff rota system in visual studio and would like to populate some textboxes with the staff names from a database to ensure the user does not miss any staff for the rota. Obviously staff will come and go therefore the number of textboxes may need to change.
For instance one week there may be 5 staff members to enter into the rota, but if a staff member leaves the company then the number of textboxes will have to automatically change and be populated with the names from the table after the staff member is deleted from the database.
For the end result I plan on having a list of textboxes populated with the names of existing staff members from the table. This will then allow the user to select their shift times and lunch hours etc.
Any advice or recommendations would be greatly appreciated.
Instead of textboxes...
Use Radio buttons if ONLY one can be selected from the list
Use Checkboxes if MORE than one can be selected from the list
Only use a textbox if you wish to EDIT the names (data)
#Thousand Thanks for the suggestion of using asp.net repeater control.
I did not wish to edit the information I was extracting so I have created a template which extracts the data into labels. Thank you and apologies as this question is in the negative.
I have a repeater with an ItemTemplate contains a CheckBox, TextBox
My repeater represents a check list plus a TextBox to put a comment to each item I select from the list.
Now, I've a page for editing an existing shopping cart in my database and it uses this repeater to enable the user to update his list. So I need to update the List with the previous selected values from the database. I can't think of a simple logic or way to access only the repeater's items that are on the previous list ...I'm thinking about trying to access each item that's in my database only instead of looping and looping.
I know It's really confusing so I'll just put it in a more illustrative way:
Database View
Items
=======================
ID Name
--- -----
1 Banana
2 Apple
3 Strawberry
4 Orange
ShopCart_Items
========================================
ItemID ItemName CartID Value
------- --------- ------- ------
2 Apple 1 1
4 Orange 1 2
2 Apple 2 2
PageView
First the repeater is populated with all the items that I have in my 'Items' table and no boxes check or anything.
Then I choose a specific cart (say cartId = 1) to edit, and here's what I'm really confused on how to do:
Now the repeater will have like 15-20 items, so I need to access just the items that the user choose on the current cart (cartId = 1) that the user want to edit, so he could know what did he choose and start choose new values, check/uncheck CheckBoxes, etc.
I'm sorry for all this long question, but I'm really confused should/can I access each item directly or what logic do you advice me to use ? ..Thanks =)
I believe that you have mix two different entities in a one repeater - an orders and order items.
In my opinion the better approach is to place two repeaters onto the page: the first one for displaying orders and the second one for displaying order items for the selected order. This way you may use simple SqlDataSource controls for both repeaters and add a ControlParameter to the datasource used for retrieving order items depending on current order selection in the first repeater.