我收到了一个错误Object reference not set to an instance of an object.我想我不会初始化一些东西.
这是代码; 错误在线if (btn.Background.Equals(new SolidColorBrush(Color.FromArgb(0, 0, 0, 0)))):
private void vbOpenGuiaMaestro_Tapped(object sender, TappedRoutedEventArgs e)
{
Button btn = default(Button);
if (btn.Background.Equals(new SolidColorBrush(Color.FromArgb(0, 0, 0, 0))))
{
btn.Background = materiaColor;
btn.Foreground = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255));
stckTeachersGuideClosed.Visibility = Visibility.Visible;
stckTeachersGuideOpened.Visibility = Visibility.Collapsed;
}
else
{
btn.Background = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));
btn.Foreground = new SolidColorBrush(Color.FromArgb(255, 140, 140, 140));
}
}
Run Code Online (Sandbox Code Playgroud) 我需要验证用户需要设置最小值,1个上限,1个下限和1个特殊字符...我只是验证用户需要最少6个字母或更多...
try
{
string actualPass = this.txtactualPass.Text;
string newPass = this.txtnewPass.Text;
string reEnterPass = this.txtReEnterPass.Text;
if (actualPass == this.Session["password"].ToString())
{
if (newPass.Length >= 6)
{
Run Code Online (Sandbox Code Playgroud)