C# Şifreyi göster tuşu nasıl yapılır?

C#:
using Microsoft.VisualBasic;
using System.Runtime.InteropServices;

namespace MyProject
{
    public partial class Form1 : Form
    {
        MessageBoxButtons buton = new MessageBoxButtons();
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            WindowState = FormWindowState.Normal;
        }

        private void btnInput_Click(object sender, EventArgs e)
        {
            {

            }
        }

        private void btnInput_MouseClick(object sender, MouseEventArgs e)
        {
            string text = Interaction.InputBox("lütfen Mesajınızı giriniz ", "Şikayet Alanı");
            if (text == "")
            {
                MessageBox.Show("Şikayet iptal edildi", "İptal edildi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                DialogResult result = MessageBox.Show("Mesajınız Doğrumu: " + text, "Onaylama", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (result == System.Windows.Forms.DialogResult.Yes)
                {
                    string metin = text;
                    StreamWriter sw = new StreamWriter("dosya.txt");
                    sw.WriteLine(metin);
                    sw.Close();
                    MessageBox.Show("Şikayetiniz iletilmiştir", "Onaylandı", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    if (result == System.Windows.Forms.DialogResult.No)
                    {
                        MessageBox.Show("Şikayetiniz geri çekilmiştir", "İptal edildi", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    }
                }
            }
        }

        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            {
                DialogResult result = MessageBox.Show("programı kapatmak istiyor musunuz?", "Çıkış", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (result == System.Windows.Forms.DialogResult.Yes)
                {
                    Application.Exit();
                }

                if (result == System.Windows.Forms.DialogResult.No)
                {
                    e.Cancel = true;
                    MessageBox.Show("Kapatma işlemi iptal edildi", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }

        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        bool move;
        int mouse_x;
        int mouse_y;

        private void Form1_MouseDown(object sender, MouseEventArgs e)
        {
            move = true;
            mouse_x = e.X;
            mouse_y = e.Y;
        }

        private void Form1_MouseUp(object sender, MouseEventArgs e)
        {
            move = false;
        }

        private void Form1_MouseMove(object sender, MouseEventArgs e)
        {
            if (move)
            {
                this.SetDesktopLocation(MousePosition.X - mouse_x, MousePosition.Y - mouse_y);
            }
        }

        private void textBox1_Enter(object sender, EventArgs e)
        {
            if (textBox1.Text == "Adınızı Giriniz")
            {
                textBox1.Text = "";
                textBox2.ForeColor = Color.White;
            }
        }

        private void textBox1_Leave(object sender, EventArgs e)
        {
            if (textBox1.Text == "")
            {
                textBox1.Text = "Adınızı Giriniz";
                textBox2.ForeColor = Color.Silver;
            }
        }

        private void textBox2_Enter(object sender, EventArgs e)
        {
            if (textBox2.Text == "Şifrenizi Giriniz")
            {
                textBox2.Text = "";
                textBox2.ForeColor = Color.White;
            }
        }


        char? none = null;
        private void textBox2_Leave(object sender, EventArgs e)
        {
            if (textBox2.Text == "")
            {
                textBox2.Text = "Şifrenizi Giriniz";
                textBox2.ForeColor = Color.Silver;
            }
        }

        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBox1.CheckState == CheckState.Checked)
            {
                textBox2.UseSystemPasswordChar = true;
                checkBox1.Text = "Şifreyi Gizle";
            }
            else
            {
                textBox2.UseSystemPasswordChar = false;
                checkBox1.Text = "Şifreyi Göster";
            }
        }
    }
}
 
Şifreyi girdiğin textbox'ın 2 numaralı olduğuna emin misin?
C#:
if(checkBox1.Checked)
{
    textBox1.UseSystemPasswordChar = false;
    checkBox1.Text = "Şifreyi gizle.";
    return;
}
textBox1.UseSystemPasswordChar = true;
checkBox1.Text = "Şifreyi göster.";

Bu bende çalışıyor çünkü. (Bende tek textbox var.)
1723385425286.gif
 
private void Form1_Load(object sender, EventArgs e)
{
WindowState = FormWindowState.Normal;
textBox2.UseSystemPasswordChar = false;
checkBox1.Text = "Şifreyi Göster";
}

bu fonksiyonu kodunuza eklemeyi denermisiniz.
düzenlenmiş kod:
C#:
using Microsoft.VisualBasic;
using System.Runtime.InteropServices;

namespace MyProject
{
    public partial class Form1 : Form
    {
        MessageBoxButtons buton = new MessageBoxButtons();
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            WindowState = FormWindowState.Normal;
            textBox2.UseSystemPasswordChar = false;
            checkBox1.Text = "Şifreyi Göster"; 
        }

        private void btnInput_Click(object sender, EventArgs e)
        {
            {

            }
        }

        private void btnInput_MouseClick(object sender, MouseEventArgs e)
        {
            string text = Interaction.InputBox("lütfen Mesajınızı giriniz ", "Şikayet Alanı");
            if (text == "")
            {
                MessageBox.Show("Şikayet iptal edildi", "İptal edildi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                DialogResult result = MessageBox.Show("Mesajınız Doğrumu: " + text, "Onaylama", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (result == System.Windows.Forms.DialogResult.Yes)
                {
                    string metin = text;
                    StreamWriter sw = new StreamWriter("dosya.txt");
                    sw.WriteLine(metin);
                    sw.Close();
                    MessageBox.Show("Şikayetiniz iletilmiştir", "Onaylandı", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    if (result == System.Windows.Forms.DialogResult.No)
                    {
                        MessageBox.Show("Şikayetiniz geri çekilmiştir", "İptal edildi", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    }
                }
            }
        }

        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            {
                DialogResult result = MessageBox.Show("programı kapatmak istiyor musunuz?", "Çıkış", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (result == System.Windows.Forms.DialogResult.Yes)
                {
                    Application.Exit();
                }

                if (result == System.Windows.Forms.DialogResult.No)
                {
                    e.Cancel = true;
                    MessageBox.Show("Kapatma işlemi iptal edildi", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }

        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        bool move;
        int mouse_x;
        int mouse_y;

        private void Form1_MouseDown(object sender, MouseEventArgs e)
        {
            move = true;
            mouse_x = e.X;
            mouse_y = e.Y;
        }

        private void Form1_MouseUp(object sender, MouseEventArgs e)
        {
            move = false;
        }

        private void Form1_MouseMove(object sender, MouseEventArgs e)
        {
            if (move)
            {
                this.SetDesktopLocation(MousePosition.X - mouse_x, MousePosition.Y - mouse_y);
            }
        }

        private void textBox1_Enter(object sender, EventArgs e)
        {
            if (textBox1.Text == "Adınızı Giriniz")
            {
                textBox1.Text = "";
                textBox2.ForeColor = Color.White;
            }
        }

        private void textBox1_Leave(object sender, EventArgs e)
        {
            if (textBox1.Text == "")
            {
                textBox1.Text = "Adınızı Giriniz";
                textBox2.ForeColor = Color.Silver;
            }
        }

        private void textBox2_Enter(object sender, EventArgs e)
        {
            if (textBox2.Text == "Şifrenizi Giriniz")
            {
                textBox2.Text = "";
                textBox2.ForeColor = Color.White;
            }
        }


        char? none = null;
        private void textBox2_Leave(object sender, EventArgs e)
        {
            if (textBox2.Text == "")
            {
                textBox2.Text = "Şifrenizi Giriniz";
                textBox2.ForeColor = Color.Silver;
            }
        }

        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBox1.CheckState == CheckState.Checked)
            {
                textBox2.UseSystemPasswordChar = true;
                checkBox1.Text = "Şifreyi Gizle";
            }
            else
            {
                textBox2.UseSystemPasswordChar = false;
                checkBox1.Text = "Şifreyi Göster";
            }
        }
    }
}
 
Şifreyi girdiğin textbox'ın 2 numaralı olduğuna emin misin?
C#:
if(checkBox1.Checked)
{
    textBox1.UseSystemPasswordChar = false;
    checkBox1.Text = "Şifreyi gizle.";
    return;
}
textBox1.UseSystemPasswordChar = true;
checkBox1.Text = "Şifreyi göster.";

Bu bende çalışıyor çünkü. (Bende tek textbox var.)
Eki Görüntüle 2281570
kontrol edeyim bi dk

private void Form1_Load(object sender, EventArgs e)
{
WindowState = FormWindowState.Normal;
textBox2.UseSystemPasswordChar = false;
checkBox1.Text = "Şifreyi Göster";
}

bu fonksiyonu kodunuza eklemeyi denermisiniz.
düzenlenmiş kod:
C#:
using Microsoft.VisualBasic;
using System.Runtime.InteropServices;

namespace MyProject
{
    public partial class Form1 : Form
    {
        MessageBoxButtons buton = new MessageBoxButtons();
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            WindowState = FormWindowState.Normal;
            textBox2.UseSystemPasswordChar = false;
            checkBox1.Text = "Şifreyi Göster";
        }

        private void btnInput_Click(object sender, EventArgs e)
        {
            {

            }
        }

        private void btnInput_MouseClick(object sender, MouseEventArgs e)
        {
            string text = Interaction.InputBox("lütfen Mesajınızı giriniz ", "Şikayet Alanı");
            if (text == "")
            {
                MessageBox.Show("Şikayet iptal edildi", "İptal edildi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                DialogResult result = MessageBox.Show("Mesajınız Doğrumu: " + text, "Onaylama", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (result == System.Windows.Forms.DialogResult.Yes)
                {
                    string metin = text;
                    StreamWriter sw = new StreamWriter("dosya.txt");
                    sw.WriteLine(metin);
                    sw.Close();
                    MessageBox.Show("Şikayetiniz iletilmiştir", "Onaylandı", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    if (result == System.Windows.Forms.DialogResult.No)
                    {
                        MessageBox.Show("Şikayetiniz geri çekilmiştir", "İptal edildi", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    }
                }
            }
        }

        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            {
                DialogResult result = MessageBox.Show("programı kapatmak istiyor musunuz?", "Çıkış", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (result == System.Windows.Forms.DialogResult.Yes)
                {
                    Application.Exit();
                }

                if (result == System.Windows.Forms.DialogResult.No)
                {
                    e.Cancel = true;
                    MessageBox.Show("Kapatma işlemi iptal edildi", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }

        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        bool move;
        int mouse_x;
        int mouse_y;

        private void Form1_MouseDown(object sender, MouseEventArgs e)
        {
            move = true;
            mouse_x = e.X;
            mouse_y = e.Y;
        }

        private void Form1_MouseUp(object sender, MouseEventArgs e)
        {
            move = false;
        }

        private void Form1_MouseMove(object sender, MouseEventArgs e)
        {
            if (move)
            {
                this.SetDesktopLocation(MousePosition.X - mouse_x, MousePosition.Y - mouse_y);
            }
        }

        private void textBox1_Enter(object sender, EventArgs e)
        {
            if (textBox1.Text == "Adınızı Giriniz")
            {
                textBox1.Text = "";
                textBox2.ForeColor = Color.White;
            }
        }

        private void textBox1_Leave(object sender, EventArgs e)
        {
            if (textBox1.Text == "")
            {
                textBox1.Text = "Adınızı Giriniz";
                textBox2.ForeColor = Color.Silver;
            }
        }

        private void textBox2_Enter(object sender, EventArgs e)
        {
            if (textBox2.Text == "Şifrenizi Giriniz")
            {
                textBox2.Text = "";
                textBox2.ForeColor = Color.White;
            }
        }


        char? none = null;
        private void textBox2_Leave(object sender, EventArgs e)
        {
            if (textBox2.Text == "")
            {
                textBox2.Text = "Şifrenizi Giriniz";
                textBox2.ForeColor = Color.Silver;
            }
        }

        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBox1.CheckState == CheckState.Checked)
            {
                textBox2.UseSystemPasswordChar = true;
                checkBox1.Text = "Şifreyi Gizle";
            }
            else
            {
                textBox2.UseSystemPasswordChar = false;
                checkBox1.Text = "Şifreyi Göster";
            }
        }
    }
}
bende yine olmadı şuan başka bilgisayardayım ondan olabilir mi?

Şifreyi girdiğin textbox'ın 2 numaralı olduğuna emin misin?
C#:
if(checkBox1.Checked)
{
    textBox1.UseSystemPasswordChar = false;
    checkBox1.Text = "Şifreyi gizle.";
    return;
}
textBox1.UseSystemPasswordChar = true;
checkBox1.Text = "Şifreyi göster.";

Bu bende çalışıyor çünkü. (Bende tek textbox var.)
Eki Görüntüle 2281570
evet öyle
 
Son düzenleme:

Technopat Haberler

Yeni konular

Geri
Yukarı