C#枚举绑定到combobox

判断某个整型是否定义在枚举中:Enum.IsDefined(typeof(SyncTimeMethod), i));
绑定到ComboBox控件:cmbSyncMethod.DataSource = System.Enum.GetNames(typeof(SyncTimeMethod));
获取:(int)Enum.Parse(typeof(SyncTimeMethod), cmbSyncMethod.Text, false);
设置:cmbSyncMethod.Text = ((SyncTimeMethod)60).ToString();

posted @ 2017-09-16 17:10  风的线条昵称已被使用  阅读(186)  评论(0编辑  收藏  举报