问题与组合框列表项连接到数据库中的表 [英] Probleam with combo box list item which connect to table in database

查看:59
本文介绍了问题与组合框列表项连接到数据库中的表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hai我的组合框有问题.对于您的信息,我有4个combox框绑定到数据库.问题是,如果我在第一个组合框中选择列表项之一,则其他第二,第三和第四个组合框将显示相同的项目.这是一个问题,因为我正在创建用于计算价格项目的表格.第一个组合框必须具有与第二,第三和第四列不同的项目列表.对于您的信息,所有此组合框都已连接到具有列项目名称的一张表.请提出建议或告诉我,如果我在第一个组合框中选择一个项目列表,那么第二,第三和第四个组合框可以显示不同的列表项目.我需要解决此问题

Hai i have a probleam with my combo box.For your info i have 4 combox box which bound to database. The probleam is if i choose one of the list item in 1st combo box then other second, third and forth combox box will display the same item. This is cause me a probleam because i am creating form for calculate price item. First combo box must have different item list from second, third and forth.For your info too all this combo box is connected to 1 table with column item name. Please advice or show me how i can make that if i choose one item list in first combo box then second , third and forth combo box can display with different list item .I need to solve this issue

推荐答案

似乎您没有正确处理更改事件.
根据您对上述问题的描述,请尝试确保以下几点.

1.四个组合框在其标识和事件处理程序(选定的索引已更改)的上下文中都有不同的名称

2.确保从任何组合框中选择项目时,没有执行任何互连的选择索引更改过程.这是什么意思是当您处理组合框1的选定索引更改事件时,它没有更改组合框2、3和4的任何内容

为了实现您的目标;
我要做的是;

1.使用表中的项目名称加载所有组合框.

2.将项目名称(DataTable)保留在会话变量或全局变量中

3.在组合框1的选定的已更改索引的属性上,我用会话或全局变量中的所有项加载组合框2、3、4,然后遍历所有项并删除在组合框1中选择的项

4.我将对组合框2和3进行步骤3

这样,组合框1、2 3和4中的所有项目都会有所不同

快乐的编码:)
It seems that you are not handling the change event properly.
From your description of the problem above, please try to make sure the following points.

1. All the four combo boxes have different names in context of their Identity and Event Handlers (Selected Index Changed)

2. Make sure that you are not performing any inter-connected selection index changing process while selecting items from any combo box. What does this mean is when you handle the selected index changed event for the combo box 1, it does not have anything which changes combo box 2, 3 and 4

To achieve your goal;
What I would do is;

1. Load all the combo boxes with the item names from the table.

2. Keep the item names (DataTable) in either a session variable or a global variable

3. On selected index changed property of combo box 1, I load the combo box 2, 3, 4 with all the items from the session or global variable, then iterate through all the items and remove the item which is selected in combo box 1

4. I would do the step 3 for combo box 2 and 3

This way, all the items would be different in combo box 1, 2 3 and 4

Happy coding :)


这篇关于问题与组合框列表项连接到数据库中的表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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