惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Martin Fowler
Martin Fowler
Jina AI
Jina AI
J
Java Code Geeks
Microsoft Security Blog
Microsoft Security Blog
Recent Announcements
Recent Announcements
I
InfoQ
L
LangChain Blog
The Cloudflare Blog
IT之家
IT之家
博客园 - 叶小钗
Apple Machine Learning Research
Apple Machine Learning Research
B
Blog
A
About on SuperTechFans
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Last Week in AI
Last Week in AI
Blog — PlanetScale
Blog — PlanetScale
罗磊的独立博客
云风的 BLOG
云风的 BLOG
Microsoft Azure Blog
Microsoft Azure Blog
Engineering at Meta
Engineering at Meta
F
Fortinet All Blogs
博客园 - 聂微东
美团技术团队
博客园_首页

博客园 - nametmp

【转】Resource与Resx的区别 - nametmp - 博客园 异步调用过程 Winform用匿名方法新建线程的方法 对C#委托的理解 对using的新认识 视频文件信息读取器 琐碎记录 【转贴】GridView里面的HYPERLINK数据邦定 【转贴】数据邦定语法 - nametmp - 博客园 TableAdapter、Dataset与BindingSource的关系 webform 可视化在gridview中加入其它控件 WinForm 加入登陆窗体(c#) winform 中的 datagridview 添加 progressbar列 和 calendar 列 远程删除Kaspersky(被Kaspersky搞了一天) SqlServer2000登陆角色的具体权限 终于用sqlcmd连上sqlserver2005express了 sqlserver操作摘录 [转]SQL Server 2005中的SQLCMD工具使用 [转]sqlserver2005(Express版)的配置
enum枚举用法笔记
nametmp · 2010-11-17 · via 博客园 - nametmp

1、定义

public enum DataType : byte
    {
        Temperature = 0x81,
        Humidity = 0x82,
        O2 = 0x83,
        CO2 = 0x84,
        C2H4 = 0x85,
    }

2、填充到combobox

cbbDatatype.Items.AddRange(Enum.GetNames(typeof(DataType)));
cbbDatatype.SelectedIndex = 0;

3、字符转enum

sTmp = cbbDatatype.SelectedItem.ToString();
datatype = (DataType)Enum.Parse(typeof(DataType), sTmp);