//日文系统中对假名和数字混合情况下的长度判断
if (2 * this.tNedit_PayeeCode_Ed.Text.ToString().Length == Encoding.Default.GetByteCount(this.tNedit_PayeeCode_Ed.Text.ToString()))
{
this.tNedit_PayeeCode_Ed.Clear();
}
if (2 * this.tNedit_PayeeCode_St.Text.ToString().Length == Encoding.Default.GetByteCount(this.tNedit_PayeeCode_St.Text.ToString()))
{
this.tNedit_PayeeCode_St.Clear();
}
//对string输出format
errMessage = string.Format("错误信息{0}", ct_NoInput);
//类型转换
parameter as ClassName;
//对于日期控件没有输入的判断
argetDateEdit.GetDateTime() == DateTime.MinValue
//用的比较多的泛型集合
Dictionary<string, string> tempValue = new Dictionary<string, string>();
//遍历Dictionary
foreach (KeyValuePair<string, string> entrytemp in sectCodeDic)
{ string.IsNullOrEmpty(entrytemp.Value) }
//List<>
List<ClassName> _detailList = new List<ClassName>();
//hashtable
Hashtable main = new Hashtable();
main.Add(key,value);
Hashtable detail = new Hashtable();
detail.Add(key,value);
appearanceTable = new Hashtable[2];
appearanceTable[0] = main;
appearanceTable[1] = detail;
//grid
this.gridName.Rows[rowIndex].Cells[COLUMN_SECTIONCODE].Value = string.Empty;
//输出固定长度
//.ToString("000000");
//转换为int类型int.Parse(string)
//几种安全类型转换
//object→string
private string StrObjectToString(object targetValue)
{
if ((targetValue == DBNull.Value) || (targetValue == null) || ((string)targetValue == string.Empty))
{
return string.Empty;
}
return (string)targetValue ;
}
//object→int
private int StrObjectToInt(object targetValue)
{
if ((targetValue == DBNull.Value) || (targetValue == null) || ((string)targetValue == string.Empty) || (int.Parse((string)targetValue) == 0))
{
return 0;
}
return int.Parse((string)targetValue);
}
private string CellTextToString(string cellText)
{
if ((cellText == null) || (cellText.Trim() == string.Empty))
{
return string.Empty;
}
return cellText.Trim().PadLeft(2, '0');
}
private int CellTextToInt(string cellText)
{
if ((cellText == null) || (cellText.Trim() == string.Empty))
{
return 0;
}
return int.Parse(cellText.Trim());
}
//关于Timer控件的使用
//在其他地方设置为true时,立即触发
private void Initial_Timer_Tick(object sender, EventArgs e)
{
this.Initial_Timer.Enabled = false;
//触发函数
ScreenReconstruction();
}
//关于Encoding的使用
Encoding encoding = System.Text.Encoding.GetEncoding("Shift_JIS");
encoding.GetByteCount(e.KeyChar.ToString());