Click here to Skip to main content
15,887,083 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How i can get all DataType to my dropDown list
so the person who use my program can select the data type from The DropDownList
DropDown List Contain
DateTime - String - Int32 .........etc
Posted

add items like this
1- you must have combobox.
2-
C#
comboBox1.Items.Add("Int32");


....Etc

3- when you want to catch selected item make switch statment on selected or intSelected variable:

SQL
string selected = comboBox1.SelectedText;
            int intSelected = comboBox1.SelectedIndex;


4- Enjoy.
Good Luck.
 
Share this answer
 
Comments
Ayham24254 22-Apr-12 17:26pm    
I need to Get it automaticlly
Like
public List<type> GetTypes()
{
return typeof(int).Assembly.GetTypes().Where(t => t.IsPrimitive).ToList();
}
But this way
not give me int32 , string ,..........
Try this :

C#
foreach (string s in Enum.GetNames(typeof(System.TypeCode)))
            {
                  comboBox1.Items.Add(s);
            }



Good Luck.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900