Results 1 to 2 of 2

Thread: How to clear a textbox once a button is clicked in WPF?

  1. #1
    Join Date
    Apr 2019
    Location
    india
    Posts
    2
    Rep Power
    0

    How to clear a textbox once a button is clicked in WPF?

    private void Button_Click(object sender, RoutedEventArgs e)
    {
    if (TextBox1.Text.Length != 0 && TextBox2.Text.Length != 0)
    {
    if (TextBox1.Text == "admin" && TextBox2.Text == "admin")
    {
    Window1 w = new Window1();
    w.Show();
    Close();
    }
    else
    {
    MessageBox.Show("username/password is invalid");
    }
    }
    else
    {
    MessageBox.Show("textbox khali hai..");
    }
    }

    private void Reset_Button_Click_1(object sender, RoutedEventArgs e)
    {
    TextBox1.Text = "";
    TextBox2.Text = "";

    }

  2. #2
    Join Date
    May 2019
    Location
    Ahemdabad
    Posts
    20
    Rep Power
    0
    private void Button_Click(object sender, RoutedEventArgs e)
    {
    if (TextBox1.Text.Length != 0 && TextBox2.Text.Length != 0)
    {
    if (TextBox1.Text == "admin" && TextBox2.Text == "admin")
    {
    Window1 w = new Window1();
    w.Show();
    Close();
    }
    else
    {
    MessageBox.Show("username/password is invalid");
    }
    }
    else
    {
    MessageBox.Show("textbox khali hai..");
    }
    }

    private void Reset_Button_Click_1(object sender, RoutedEventArgs e)
    {
    TextBox1.Clear();
    TextBox2.Clear();
    }

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 08-11-2009, 07:24 PM
  2. Transparent Clear Sticker Printing
    By muqtada123 in forum Other Webmaster-related Services and Promotion
    Replies: 0
    Last Post: 13-06-2009, 03:30 AM
  3. parse value dari textbox ke textbox...URGENT
    By arsenalfc82 in forum Website Programming
    Replies: 9
    Last Post: 13-01-2008, 02:07 PM
  4. Clear adsense check
    By corallinkz in forum Revenue and Monetization
    Replies: 17
    Last Post: 15-01-2007, 09:20 AM
  5. google adsense - clear cheque
    By antudegil in forum Revenue and Monetization
    Replies: 11
    Last Post: 31-08-2005, 03:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Search Engine Optimization by vBSEO 3.5.0 RC1 PL1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112