SuchFonktion abschalten wenn der Verzeichnis falsch wäre oder der Suchtext leer ist



  • hi could you held me solvins this problem
    iam coding a program that make desactivate a search function ( button)
    when the text  is empty or the file pfad  ist not correct but u got this mistake

    System.NullReferenceException means the button search was  "null"

    public partial class MainWindow : Window
    {
    public MainWindow()
    {
    InitializeComponent()

    }

    private void TbSearch_TextChanged(object sender, TextChangedEventArgs e)
    {
    if(tbSearch.Text== null)
    btnSearching.IsEnabled = false;
    else btnSearching.IsEnabled= true;
    return;
    }

    private void tbnPfad_TextChanged( object sender, TextChangedEventArgs e)
    {

    if(!Directory.Exists(tbnPfad.Text))
    btnSearch.IsEnabled = false;
    else btnSearch = true;
    return;
    }
    }



  • This post is deleted!

Log in to reply