如何在窗体中使用其他组合框获得组合框中的相对值 [英] how to get relative value in combobox using other combobox in windows form

查看:79
本文介绍了如何在窗体中使用其他组合框获得组合框中的相对值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有3个组合框(项目名称,品牌名称,价格),但项目名称可以是几个品牌,每个品牌有不同的价格。现在我想这样做,当用户使用第一个组合框选择项目名称时,它会在第二个组合框中显示它的合适品牌。当用户使用第二个组合框选择品牌名称时,它会在第三个组合框中显示它的价格。

假设我有项目牛仔裤,它有5个品牌(lee,levise,coutons,cotton county,liver pool)品牌有不同的价格(999,1099,1599,2000,2599)。

当用户选择品牌=牛仔裤使用combobox1然后它显示5个品牌(李,levise,coutons,棉花县,肝脏池)在combobox2中当用户选择品牌名称时,那么价格应该显示为999,当用户选择肝池时,价格应该显示为2599,依此类推.....在组合框中。

我该怎么办?做??????

plz帮帮我

谢谢......

i have 3 combobox(item name,brand name,price) but item name can be several brands and each brand has different price. now i want to do that, when user select item name using first combobox then it shows it's appropriate brand in second combobox. and when user select brand name using second combobox then it shows it's price in third combobox.
suppose i have item jeans and it has 5 brands(lee,levise,coutons,cotton county,liver pool) each brand has it's different price(999,1099,1599,2000,2599).
when user select brand=jeans using combobox1 then it shows 5 brands(lee,levise,coutons,cotton county,liver pool) in combobox2 and when user select brand name lee then price should be shown 999 and when user select liver pool then price should be shown 2599 and so on..... in combobox.
what should i do??????
plz help me
thankyou......

推荐答案

您好,



试试这个例子..



在Winforms Windows Forms C#VB.NET中创建ComboBox



谢谢

animesh
Hello ,

try this example..

Cascading ComboBox In Winforms Windows Forms C# VB.NET

thanks
animesh


试试这个。

让你有三个组合框ddl1,ddl2和ddl3(分别用于商品,品牌和价格。)



编写代码(使用单独的函数fillItemName())从数据库中获取数据(项目名称)并将其与ddl1绑定。你必须在page_load事件中调用这个函数。



在ddl1_selectedIndexChanged()中编写代码,使用Query中的where子句从数据库中获取数据(brandname)并将其与ddl2绑定。



在ddl2_selectedIndexChanged()中编写代码,使用Query中的where子句从数据库中获取数据(价格)并将其与ddl3绑定(或者写入ddl3.Text = ds.Tables [0] .rows [0] [0] .ToString())。



如果有效,请告诉我。
Try this.
let you have three combobox ddl1 ,ddl2 and ddl3(for item,brand and price respectively.)

write codes(making a separate function fillItemName() ) to fetch data(item name) from database and bind it with ddl1. you must call this function in page_load event.

write codes in ddl1_selectedIndexChanged() to fetch data(brandname) from database using where clause in Query and bind it with ddl2.

write codes in ddl2_selectedIndexChanged() to fetch data(price) from database using where clause in Query and bind it with ddl3(OR write ddl3.Text = ds.Tables[0].rows[0][0].ToString()).

if it works, let me know.


这篇关于如何在窗体中使用其他组合框获得组合框中的相对值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆