Hallo ich möchte gerne das nach dem Button Click der Cursor wieder zum ersten TabIndex springt
hier mal mein Code ( Button14 ist das Problemkind, bei Button10 funktioniert es ja mit dem neu initialisieren)
wäre für Infos recht Dankbar
hier mal mein Code ( Button14 ist das Problemkind, bei Button10 funktioniert es ja mit dem neu initialisieren)
C#:
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;
using System.Media;
using System.Data.Odbc;
using System.Data.OleDb;
namespace Guthaben
{
public partial class Guthaben : Form {
private OleDbConnection con;
private OleDbCommand sql;
public Guthaben()
{
InitializeComponent();
String connect = "Provider=Microsoft.JET.OLEDB.4.0;" +
"data source=c://temp//Guthabenkarte.mdb";
con = new OleDbConnection(connect);
con.Open();
sql = con.CreateCommand();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
tbRechnung.Text += "1";
SoundPlayer simpleSound = new SoundPlayer(@"c://temp//Click.wav");
simpleSound.Play();
}
private void button2_Click(object sender, EventArgs e)
{
tbRechnung.Text += "2";
SoundPlayer simpleSound = new SoundPlayer(@"c://temp//Click.wav");
simpleSound.Play();
}
private void button3_Click(object sender, EventArgs e)
{
tbRechnung.Text += "3";
SoundPlayer simpleSound = new SoundPlayer(@"c://temp//Click.wav");
simpleSound.Play();
}
private void button4_Click(object sender, EventArgs e)
{
tbRechnung.Text += "4";
SoundPlayer simpleSound = new SoundPlayer(@"c://temp//Click.wav");
simpleSound.Play();
}
private void button5_Click(object sender, EventArgs e)
{
tbRechnung.Text += "5";
SoundPlayer simpleSound = new SoundPlayer(@"c://temp//Click.wav");
simpleSound.Play();
}
private void button6_Click(object sender, EventArgs e)
{
tbRechnung.Text += "6";
SoundPlayer simpleSound = new SoundPlayer(@"c://temp//Click.wav");
simpleSound.Play();
}
private void button7_Click(object sender, EventArgs e)
{
tbRechnung.Text += "7";
SoundPlayer simpleSound = new SoundPlayer(@"c://temp//Click.wav");
simpleSound.Play();
}
private void button8_Click(object sender, EventArgs e)
{
tbRechnung.Text += "8";
SoundPlayer simpleSound = new SoundPlayer(@"c://temp//Click.wav");
simpleSound.Play();
}
private void button9_Click(object sender, EventArgs e)
{
tbRechnung.Text += "9";
SoundPlayer simpleSound = new SoundPlayer(@"c://temp//Click.wav");
simpleSound.Play();
}
private void button10_Click(object sender, EventArgs e)
{
tbRechnung.Text += "0";
SoundPlayer simpleSound = new SoundPlayer(@"c://temp//Click.wav");
simpleSound.Play();
}
private void button11_Click(object sender, EventArgs e)
{
tbRechnung.Text += ",";
SoundPlayer simpleSound = new SoundPlayer(@"c://temp//Click.wav");
simpleSound.Play();
}
private void button12_Click(object sender, EventArgs e)
{
tbRechnung.Text += "00";
SoundPlayer simpleSound = new SoundPlayer(@"c://temp//Click.wav");
simpleSound.Play();
}
private void button13_Click(object sender, EventArgs e)
{
tbRechnung.Clear();
}
private void button14_Click(object sender, EventArgs e)
{
tbRestguthaben.Text= System.Convert.ToString(System.Convert.ToDouble(tbGuthaben.Text) - System.Convert.ToDouble(tbRechnung.Text));
sql.CommandText = "Update Guthaben set Betrag= '" + tbRestguthaben.Text + "'Where Kartennummer=" + tbKartennummer.Text + "";
sql.ExecuteNonQuery();
this.Controls.Clear();
this.InitializeComponent();
}
private void textBox3_TextChanged(object sender, EventArgs e)
{
sql.CommandText = "select * from Guthaben Where Kartennummer=" + int.Parse(tbKartennummer.Text);
OleDbDataReader reader = sql.ExecuteReader();
tbGuthaben.Clear();
while (reader.Read())
{
tbGuthaben.AppendText("" + reader.GetValue(2) + "");
}
reader.Close();
}
private void button10_Click_1(object sender, EventArgs e)
{
Login Login = new Login();
Login.Show();
this.Controls.Clear();
this.InitializeComponent();
}
}
}
wäre für Infos recht Dankbar