简体   繁体   中英

vb.net selecting option from combobox and displaying in a textbox

I've been trying to find a solution since very long but no avail.

I'm trying to make my program such that when i select a code from a combobox,it should display a description related to that code in one textbox and display a number in another textbox. Once this is done,it should create another combobox on the next line with exactly the same items. Eg

Code            Description               cost           tax
1141            Replace battery           10.00          14.00
  • All items under "code" are in a combobox for the user to select.
  • If a user selects "1141",the program fills in the description "replace battery" and the cost only

I'm using VB.NET 2005.

Generally, you need to handle the SelectedValueChanged event on the ComboBox , and do a lookup of some sort to get the values to set into the TextBoxes . For example, you could have an array of all your SaleItem objects (which would store Code , Description , cost , tax ), and you'd search the array until you found a matching Code .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM