我不知道哪里出错了.当我构建它时,搜索DLL登录的默认路径.尽管我指定了路径.
我已经将我的.snk文件创建并存储在与DLL相同的位置.
//Assembly info file for errorcollection
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ErrorCollection")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ErrorCollection")]
[assembly: AssemblyCopyright("Copyright © 2010")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to …Run Code Online (Sandbox Code Playgroud) 我成功创建了一个用于显示错误消息的用户控件.现在一切正常但是当显示消息时,可以访问后台控件.如何禁用页面控件或页面单击或选择任何控件.当消息面板关闭时,它应该启用页面控件.
我找到了答案的朋友.
void DisableControls(Control parent, bool status)
{
foreach (Control c in parent.Controls)
{
if (c is DropDownList)
{
((DropDownList)(c)).Enabled = status;
}
if (c is Button)
{
((Button)(c)).Enabled = status;
}
if (c is TextBox)
{
((TextBox)c).Enabled = status;
}
if (c is RadioButton)
{
((RadioButton)c).Enabled = status;
}
if (c is ImageButton)
{
((ImageButton)c).Enabled = status;
}
if (c is CheckBox)
{
((CheckBox)c).Enabled = status;
}
if (c is DropDownList)
{
((DropDownList)c).Enabled = status;
}
if (c is …Run Code Online (Sandbox Code Playgroud) 我需要一个功能来验证输入的日期.输入日期是否格式正确.我浏览了网页并得到了正则表达式.它的工作正常,除非你输入12/12/YYYY(在任何一年)它显示错误,说它不是一个有效的日期.
bool IsDate(string date)
{
Match dobMatch = Regex.Match(date, @"^(((0[1-9]|[12]\d|3[01])\/(0[13578]|1[02])\/((19|[2-9]\d)\d{2}))|((0[1-9]|[12]\d|30)\/(0[13456789]|1[012])\/((19|[2-9]\d)\d{2}))|((0[1-9]|1\d|2[0-8])\/02\/((19|[2-9]\d)\d{2}))|(29\/02\/((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))))$");
if (!dobMatch.Success)
{return true;}
else
{return false;}
}
Run Code Online (Sandbox Code Playgroud)
一世