在c#winform中使用checkedlistbox [英] Working with checkedlistbox in c# winform

查看:299
本文介绍了在c#winform中使用checkedlistbox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们

请知道关于使用checkedlistbox的第一个问题,所有只使用的是列表框。现在我需要设计一个包含两个文本框的表单,分别是NameTextbox,AgeTextbox和一个名为AllergyBox的checkedlistbox,我想要做的是让用户能够在文本框中填写他们的姓名和年龄,并选择他们不同的过敏通过检查checkedlistbox中的任何项目来检查列表框,然后有一个保存按钮,单击此按钮应该将checkedlistbox的已检查项目和文本框的值保存到sql server db中的表。但我知道如何将文本框和checklistbox检查项保存到db中的同一行,或者我应该创建另一个表,然后使用一个表的主键作为另一个表中的外键。我只想清楚这一点,并将我链接到有关checkedlistbox的教程。在此先感谢。

Hi friends
pls i dnt know the first thign about using a checkedlistbox, all have only worked with is a listbox. Now i have a requirement to design a form that has two textboxes which are NameTextbox, and AgeTextbox and a checkedlistbox called AllergyBox, what i want to do is for users to be able to fill their name and age in the textboxes and select their different allergies with the checkedlistbox by checking on any of the items in the checkedlistbox then there is a save button, on click of this button should save the checked items of the checkedlistbox and the value of the textboxes to a table in sql server db. But i dnt know how possible it is to save the textboxes and the checklistbox checked item to the same row in db or should i create another table then use the primary key of one table as the foreign key in the other. Please i just want to be clear with this, and also link me to tutorials about checkedlistbox. Thanks in advance.

推荐答案

您需要创建如下表格

1)元数据表,其中包含所有过敏信息

2)相同姓名,年龄等的患者详细信息表。

3)Patient_Allergies表,其中包含两个表的外键和同一患者的多个条目。如果需要,您还可以存储更多信息,例如日期,时间戳。



一些有用的链接



如何绑定复选框列表,示例 [ ^ ]

复选框列表所需的字段验证 [ ^ ]
You needs to create table as below
1) metadata table which contains all allergy information in detail
2)Patient Details table to same name, age etc.
3) Patient_Allergies table which contains foreign key to both tables and multiple entries for same patient. You can also store more info like from date to date, timestamp if required.

Some useful links

How to bind Check box list,with example[^]
required field validation with checkboxlist[^]


这篇关于在c#winform中使用checkedlistbox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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