Visual Basic Express 2013 - List Boxes - c#

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!

Related

Get dynamic input from user

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.

Set Checkbox Values to a Specific values

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 ?

list large numbers of items in dropdown asp.net c#

I have currently implemented a drop-down which displays all the products name from database. On selection of product name from drop down my edit product form will get populated and user can update selected record successfully.
Now my problem is that i have 5000 products in my database.In this case its very difficult for end user to select particular product in drop-down and also populating drop down with large number of records server side takes more time.
What approach should i use to make selection user friendly.Any ideas or help is greatly appreciated
Thanks!!!!
You should use an editable combo box with auto complete feature and load the data depending on user input. Refer this: http://www.asp.net/AjaxLibrary/AjaxControlToolkitSampleSite/ComboBox/ComboBox.aspx
This way you dont need to worry about the amount of data, it gets filtered as the user inputs some string.

Insert number of textboxes relating to number of rows in a database table

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.

Dynamic Select lists C#

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.

Categories

Resources