c# - How to clear the text of all textBoxes in the form or in The groupBox

c# - How to clear the text of all textBoxes in the form or in The groupBox

                                                                                        

In This C# Tutorial We Will See How You Can Remove The Text From All TextBoxes In The Form Or In The GroupBox Using CSharp Programming Language..


Source Code :

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Clear_TextBoxes : Form
    {
        public Clear_TextBoxes()
        {
            InitializeComponent();
        }

        private void BTN_FORM_Click(object sender, EventArgs e)
        {
            foreach(Control c in Controls)
            {
                if(c is TextBox)
                {
                    c.Text = "";
                }
            }
        }

        private void BTN_GRBX_Click(object sender, EventArgs e)
        {
            foreach (Control c in groupBox1.Controls)
            {
                if (c is TextBox)
                {
                    c.Text = "";
                }
            }
        }

        private void button3_Click(object sender, EventArgs e)
        {
            BTN_FORM.PerformClick();
            BTN_GRBX.PerformClick();
        }
    }

}
=> OutPut :

Clear All TextBoxes In C#
Clear All TextBoxes In C#



C# - How To Create Login Form In C# With Access Database [with source code]

C# - How To Create Login Form In C# With Access Database [with source code]

C# - How To Create Login Form In C# With Access Database [with source code]

                                                                                                                                         

In This C# Tutorial We Will See How To Make A Login Form Using CSharp Programming Language And Access Database.



Project Source Code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
 
namespace LoginPrj
{
    public partial class TestForm : Form
    {
        OleDbConnection cn = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Documents\DataBase1.accdb");
        OleDbDataAdapter da;
        DataTable dt = new DataTable();
        public TestForm()
        {
            InitializeComponent();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            da = new OleDbDataAdapter("select * from MyTab where Email='"+textBox1.Text+"' and Password='"+textBox2.Text+"'",cn);
            da.Fill(dt);
            if (dt.Rows.Count <= 0)
            {
                if(panel1.Height == 0)
                {
                    label1.Text = "Email Or Passwor are Invalide Please try again";
                    timer1.Start();
                }
                else if (panel1.Height == 100)
                {
                    timer2.Start();
                    label1.Text = "";
                }
            }
            else if (dt.Rows.Count > 0)
            {
                if (panel1.Height == 0)
                {
                    label1.Text = "Login Succsufully";
                    timer1.Start();
                }
                else if (panel1.Height == 100)
                {
                    timer2.Start();
                    label1.Text = "";
                }
            }
 
            dt.Clear();
        }
 
        private void timer1_Tick(object sender, EventArgs e)
        {
            if(panel1.Height != 100)
            {
                panel1.Height +=5;
                if(panel1.Height == 100)
                {
                    timer1.Stop();
                }
            }
        }
 
        private void timer2_Tick(object sender, EventArgs e)
        {
            if (panel1.Height != 0)
            {
                panel1.Height -= 5;
                if (panel1.Height == 0)
                {
                    timer2.Stop();
                }
            }
        }
 
        private void button2_Click(object sender, EventArgs e)
        {
            timer2.Start();
        }
    }
}

////////////////////////////////END
Other Login Form Post:
Create Login Form In C# With MySQL Database


C# - How To Add Placeholder Text To Textbox In C#

C# - How To Add Placeholder Text To Textbox In C#

C# - How To Add Placeholder Text To Textbox In C#

                                                                                                                                                           

in this c# tutorial we will see how to create a textbox placeholder in C# .


Project Source Code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MyApp
{
    public partial class TextBoxPalceHolder : Form
    {
        public TextBoxPalceHolder()
        {
            InitializeComponent();
        }

        private void TextBoxPalceHolder_Load(object sender, EventArgs e)
        {
            this.ActiveControl = label1;
            textBox1.GotFocus += new EventHandler(this.TextGotFocus);
            textBox1.LostFocus += new EventHandler(this.TextLostFocus);

        }

        public void TextGotFocus(object sender , EventArgs e)
        {
            TextBox tb = (TextBox)sender;
            if (tb.Text == "Your Text ..........")
            {
                tb.Text = "";
                tb.ForeColor = Color.Black;
            }
        }

        public void TextLostFocus(object sender , EventArgs e)
        {
            TextBox tb = (TextBox)sender;
            if(tb.Text=="")
            {
                tb.Text = "Your Text ..........";
                tb.ForeColor = Color.LightGray;
            }
        }
    }
}


Change a webBrowser Background Color with colorDialog in C#

Change a webBrowser Background Color with colorDialog in C#

Change a webBrowser Background Color with colorDialog in C#

                                                                                                                                                           

in this c# tutorial we will see how to change a webBrowser control Background Color using C# .


Project Source Code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Csharp_And_MySQL
{
    public partial class WebBroser_Background_Color : Form
    {
        public WebBroser_Background_Color()
        {
            InitializeComponent();
        }

        private void BTN_COLOR_Click(object sender, EventArgs e)
        {

            DialogResult colors = colorDialog1.ShowDialog();

            if(colors == DialogResult.OK)
            {
                string colorCode = ColorTranslator.ToHtml(colorDialog1.Color).ToString();

                textBox_Color.Text = colorCode;

                webBrowser1.DocumentText = "<html><body style='background-color:"+colorCode+"'></body></html>";

            }
        }
    }
}



flat button appearance in c#

flat button appearance in c#

Flat Button Appearance In C#



in this c# tutorial we will see how to make a flat button Appearance using c#.
to do that you need to follow this steps:
 in FlatStyle:
       Make FlatStyle to Flat 
 in FlatAppearance: 
           Change the BorderColor 
           Change the BorderSize 
          Change the MouseDownBackColor 
           Change the MouseOverBackColor