I am getting trouble regarding how to code this. First I have to assign something for each item within the list (
1 for that first item,
2 for that second and so forth). Performs this control possess a separate area for that value apart from text?
Second, I have to place this into my database(MSSQL 2008) within this format:
insert into table values(ID,
Can someone guide me regarding how to accomplish this.
An effective way to get this done is always to use Enumerated Values to fill your Checked Combo Box, this enables you to be sure the association from the products within the list using their values. To transform the Enum to some liveable format that you can do something similar to this.
Imports System.ComponentModel Imports System.Reflection Public Enum ePregnancyCode <Description("Not Specified")> _ NotSpecified <Description("Not Pregnant")> _ NotPregnant <Description("Pregnant")> _ Pregnant End Enum
After which retrieve the
Description area by using this code
Public Function GetDescription(ByVal EnumConstant As [Enum]) As String Dim fi As FieldInfo = EnumConstant.GetType().GetField(EnumConstant.ToString()) Dim aattr() As DescriptionAttribute = _ DirectCast( _ fi.GetCustomAttributes(GetType(DescriptionAttribute), False), _ DescriptionAttribute() _ ) Return If(aattr.Length > 0, aattr(0).Description, EnumConstant.ToString()) End Function
You'd most likely be best utilizing a research edit for the Combo Selection since I consider it. You'll be able to just retrieve the chosen item collection in the Control when you attend place in to the database.