当使用该代码混淆器Dotfuscator Community Edition时,会提示注册激活专业版,可以跳过不注册。
使用该工具会有个问题。就是下拉框的值会取不到!
下面是详细过程。代码片段为使用的插入combobox列表数据的方法。
class comboBoxHelper{/// <summary>
/// 填充数据库查询的下拉框数据
/// </summary>
/// <param name="cb">指定combobox</param>
/// <param name="dispColumn">要显示的列</param>
/// <param name="tableName">要查询的表名</param>
public static void fillComboBox(ComboBox cb, string dispColumn,string tableName)
{
SqlConnection conn = msSqlConnection.GetCon();
SqlDataReader reader = dbUtil.findBySql("select sid, "+dispColumn+" from "+tableName, conn);
ArrayList list = new ArrayList();
while (reader.Read())
{
list.Add(new ListObject((long)reader["sid"], "", reader[dispColumn].ToString(), 0));
}
reader.Dispose();
msSqlConnection.dispose(conn);
if (list.Count == 0)
{
return;
}
cb.DisplayMember = "strName";
cb.ValueMember = "longSid";
cb.DataSource = list;
}
}
上面代码片段中用到的ListObject类
/*
* 此类用来存储list中的对象,当选中时方便从中抽取需要的字段
* **/
public class ListObject
{
//sid
private long sid;
//速记码或者编号
private String codeValue;
//姓名或者名称
private String nameValue;
//listBox中显示时编号与名称的格式设置,方便名称对齐
private int cols;
public listObject(long sid, String codeValue, String nameValue,int cols)
{
this.sid = sid;
this.codeValue = codeValue;
this.nameValue = nameValue;
this.cols = cols;
}
public long longSid
{
get
{
return sid;
}
set
{
sid = value;
}
}
public String strCode
{
get
{
return codeValue;
}
set
{
codeValue = value;
}
}
public String strName
{
get
{
return nameValue;
}
set
{
nameValue = value;
}
}
//重载ToString方法,方便在listBox中自动调用显示
override public String ToString()
{
return appendSpace(codeValue,cols) + nameValue;
}
}
发现当使用代码混淆器后,运行时通过this.comboBox1.SelectedValue是无法取到值的。
bug?
who kowns?
放弃转而使用其他工具了。本来我就是个Java自由人,.net偶尔用一下而已。
本文描述了使用代码混淆器Dotfuscator Community Edition时遇到的问题,即ComboBox的值在混淆后无法正确获取。提供了具体的代码片段及解决方案。
9702

被折叠的 条评论
为什么被折叠?



