İnternet bankacılığındaki anne soyad kontrol sistemi C#.NET



NOT:Öncelikle Anne soyadı ekleye tıklanır.Değiştir butonuna basılarak hangi harflerin girileceği labellere rasgele (random) gelir.Her tıklandığında farklı harfler sorulur.
[code lang=”csharp”]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 WindowsFormsApplication4
{
public partial class Form1 : Form
{
string asoyad;
Random r = new Random();
int[] kontrol = new int [2];
int sayac;
int h1;
string a1, a2;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
a1 = textBox2.Text;
a2 = textBox3.Text;
try
{
if ((a1[0] == asoyad[kontrol[0]]) && (a2[0] == asoyad[kontrol[1]]))
{
MessageBox.Show("harfler doğru");
}
else
{
MessageBox.Show("doğru değil");
}
}
catch
{
;
}
}
private void button2_Click(object sender, EventArgs e)
{
asoyad = textBox1.Text;
}
private void button3_Click(object sender, EventArgs e)
{
try
{
while (sayac < 2)
{
h1 = r.Next((asoyad.Length ));
if (Array.IndexOf(kontrol,h1) == -1)
{
kontrol[sayac] = h1;
sayac++;
}
}
label2.Text = "Anne soyadın " + (kontrol[0]+1).ToString() + " .harfi";
label3.Text = "Anne soyadın " + (kontrol[1]+1).ToString() + " .harfi";
sayac = 0;
}
catch
{
;
}
}
}
}[/code]