下拉列表包含C#中的DataType [英] DropDown List contain DataType in C#
本文介绍了下拉列表包含C#中的DataType的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将所有DataType放入我的下拉列表
因此使用我程序的人可以从DropDownList
中选择数据类型
下拉列表包含
DateTime-字符串-Int32 .........等
解决方案
添加类似这样的项目
1-您必须有组合框.
2-
comboBox1.Items.Add(" );
.... Etc
3-当您要捕获所选项目时,请在selected或intSelected变量上设置开关状态:
选择的字符串= comboBox1.SelectedText; int intSelected = comboBox1.SelectedIndex;
4-享受.
祝你好运.
尝试一下:
foreach (字符串 s 在 Enum.GetNames( typeof (System.TypeCode)))中 { comboBox1.Items.Add(s); }
祝你好运.
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
解决方案
add items like this
1- you must have combobox.
2-
comboBox1.Items.Add("Int32");
....Etc
3- when you want to catch selected item make switch statment on selected or intSelected variable:
string selected = comboBox1.SelectedText; int intSelected = comboBox1.SelectedIndex;
4- Enjoy.
Good Luck.
Try this :
foreach (string s in Enum.GetNames(typeof(System.TypeCode))) { comboBox1.Items.Add(s); }
Good Luck.
这篇关于下拉列表包含C#中的DataType的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文