我对此代码有问题,左右按钮不起作用..在代码的最后部分.请你帮助我好吗.. [英] i have a problem with this code the right and left button not working.. at the last part of the code. could you please help me..

查看:41
本文介绍了我对此代码有问题,左右按钮不起作用..在代码的最后部分.请你帮助我好吗..的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

using System;
i have a problem with this code the right and left button not working..
at the last part of the code.
could you please help me..

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

namespace CustomerClient
{
    public partial class UsernameKeypad : Form
    {
        public UsernameKeypad()
        {
            InitializeComponent();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            Close();
        }
        private void button8_Click(object sender, EventArgs e)
        {
        }
        private void textBoxUsername_TextChanged(object sender, EventArgs e)
        {
              textBox1.SelectionLength = 0;
              textBox1.SelectionStart = textBox1.Text.Length;
              textBox1.Focus();
              textBox1.ScrollToCaret();
         }

        private void button37_Click(object sender, EventArgs e)
        {
            Button cliked = (Button)sender;
            textBox1.Text += cliked.Text;
        }
        private void button29_Click(object sender, EventArgs e)
        {
        }
        private void button12_Click(object sender, EventArgs e)
        {
        }
        private void button13_Click(object sender, EventArgs e)
        {
        }
        private void button14_Click(object sender, EventArgs e)
        {
        }
        private void button15_Click(object sender, EventArgs e)
        {
        }
        private void button16_Click(object sender, EventArgs e)
        {
        }
        private void button17_Click(object sender, EventArgs e)
        {
        }
        private void button18_Click(object sender, EventArgs e)
        {
        }
        private void button19_Click(object sender, EventArgs e)
        {
        }
        private void button20_Click(object sender, EventArgs e)
        {
        }
        private void button21_Click(object sender, EventArgs e)
        {
        }
        private void button22_Click(object sender, EventArgs e)
        {
        }
        private void button23_Click(object sender, EventArgs e)
        {
        }
        private void button24_Click(object sender, EventArgs e)
        {
        }
        private void button25_Click(object sender, EventArgs e)
        {
        }
        private void button26_Click(object sender, EventArgs e)
        {
        }
        private void button27_Click(object sender, EventArgs e)
        {
        }
        private void button28_Click(object sender, EventArgs e)
        {
        }
        private void button30_Click(object sender, EventArgs e)
        {
        }
        private void button31_Click(object sender, EventArgs e)
        {
        }
        private void button32_Click(object sender, EventArgs e)
        {
        }
        private void button33_Click(object sender, EventArgs e)
        {
        }
        private void button34_Click(object sender, EventArgs e)
        {
        }
        private void button35_Click(object sender, EventArgs e)
        {
        }
        private void button36_Click(object sender, EventArgs e)
        {
        }
        private void button7_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "")
            {
                MessageBox.Show("Sorry!! Please Input your username.. :) ");
            }
        }
        private void button10_Click(object sender, EventArgs e)
        {
            button37.Text="q";
            button29.Text = "w";
            button12.Text = "e";
            button13.Text = "r";
            button14.Text = "t";
            button15.Text = "y";
            button16.Text = "u";
            button17.Text = "i";
            button18.Text = "o";
            button19.Text = "p";
            button20.Text = "a";
            button21.Text = "s";
            button22.Text = "d";
            button23.Text = "f";
            button24.Text = "g";
            button25.Text = "h";
            button26.Text = "j";
            button27.Text = "k";
            button28.Text = "l";
            button30.Text = "z";
            button31.Text = "x";
            button32.Text = "c";
            button33.Text = "v";
            button34.Text = "b";
            button35.Text = "n";
            button36.Text = "m";
            button2.Visible = true;
            button10.Visible=false;
        }
        private void button2_Click(object sender, EventArgs e)
        {
            button10.Visible = true;
            button2.Visible = false;
            button37.Text = "Q";
            button29.Text = "W";
            button12.Text = "E";
            button13.Text = "R";
            button14.Text = "T";
            button15.Text = "Y";
            button16.Text = "U";
            button17.Text = "I";
            button18.Text = "O";
            button19.Text = "P";
            button20.Text = "A";
            button21.Text = "S";
            button22.Text = "D";
            button23.Text = "F";
            button24.Text = "G";
            button25.Text = "H";
            button26.Text = "J";
            button27.Text = "K";
            button28.Text = "L";
            button30.Text = "Z";
            button31.Text = "X";
            button32.Text = "C";
            button33.Text = "V";
            button34.Text = "B";
            button35.Text = "N";
            button36.Text = "M";
        }
        private void button11_Click(object sender, EventArgs e)
        {
            textBox1.Text = textBox1.Text + " ";
        }
        private void button4_Click(object sender, EventArgs e)
        {
             int textlength = textBox1.Text.Length;
               if (textlength > 0)
                {
                    for (int i = 0; i < textlength;i++ )
                    {
                        textBox1.Text = textBox1.Text.Substring(0, textlength - 1);
                    }
                }
           textBox1.Focus();
        }

        private void leftbtn_Click(object sender, EventArgs e)
        {
            if (textBox1.SelectionStart > 0)
                textBox1.SelectionStart--;
        }
        private void rightbtn_Click(object sender, EventArgs e)
        {
        }
    }
}

推荐答案

不起作用?这不足以理解问题.

您遇到错误了吗?尝试将调试点放入代码中,以查看右键单击是否执行.
确保单击事件处理程序已附加到此代码上.
Not working? That is not enough to understand the problem.

Are you getting an error? Trying putting debug points in the code to see if the right / left button clicks execute.
Make sure the click event handlers are attached to this code.


这不是软件的开发方式.扔掉并从头开始.任何按钮的名称都不应类似于button_11,不得重复任何代码片段.不应使用"A","B"之类的立即数.有参数方法的头吗?您还没有准备好开发UI,学习方法,方法调用,参数,变量,委托,事件.从控制台应用程序开始.在您能够编写代码而不是编写不正确的内容之前,请不要再回到更高级的主题.别浪费时间了;您所做的不起作用.

—SA
This is not how software is developed. Throw it out and start from scratch. No button should have the name like button_11, no fragment of code should be repeated. No immediate constant like "A", "B" should be used. Ever head of methods with parameters? You are not ready to develop UI, learn methods, method calls, parameters, variables, delegates, events. Start with console applications. Don''t come back to more advanced topic until you''re able to write code and not what you write right not. Stop wasting your time; what you do is not working.

—SA


这篇关于我对此代码有问题,左右按钮不起作用..在代码的最后部分.请你帮助我好吗..的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆