简体   繁体   English

有一个问题。我已经点击了第二个文本框,但它一直出现在两个文本框中。 当我点击它的文本框时,我希望号码弹出。 1 当时

[英]have a prob.I already click the second textbox but it keeps appearing in both. I WANT THE NUMBER TO POP WHEN I CLICK ITS TEXTBOX. 1 at the time

MY CODE:我的代码:

namespace textbox { public partial class Form1 : Form { public Form1() { InitializeComponent();命名空间文本框 { 公共部分类 Form1 : Form { public Form1() { InitializeComponent(); } }

    private void button2_Click(object sender, EventArgs e)
    {
        textBox1.Text = textBox1.Text + "2";


    }

    private void button1_Click(object sender, EventArgs e)
    {


        textBox1.Text = textBox2.Text += "1";

    }

    private void textBox2_TextChanged(object sender, EventArgs e)
    {

    }
}

} }

In your button1_Click method, the textBox1.Text is attributed the result of concatenating "1" to textBox2.Text .在您的button1_Click方法中, textBox1.Text归因于将 "1" 连接到textBox2.Text I think this is the cause of your problem.我认为这就是你的问题的原因。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 C#如何在第二个文本框中输入数字。 每当我单击按钮时,它就会一直出现在第一个文本框中 - C# how to input numbers in to the second text box. whenever I click the button it keeps appearing in the 1st textbox 当我单击树形列表时,我希望在devExpress的文本框中显示一个单词 - When I click on a treelist, I want a word to appear in a textbox with devExpress 当我单击时,文本框固定在顶部 - Textbox pin to top when i click on it 当我双击文本框中的一个单词时,我想在C#wpf中获得该单词(“ text”) - When I double click on a word in the textbox I want to get that word(“text”) in a C# wpf 当我点击它时,如何使文本框不可编辑? - How can I make textbox not editable when I click out of it? 当单击空的asp:textbox时,我想立即将asp:label的可见性设置为false - when click on empty asp:textbox I want to set the visibility of a asp:label to false immediately 掩码不允许在文本框中留空。 我怎么能改变这个? - Mask is not allowing blank in textbox. How can I change this? 我无法将CMD输出显示在我的文本框中。 - I cant get the CMD outputs to display in my textbox. 我需要更改文本框的名称,而不是文本框中的文本。 然后使用该名称来命名一个单独的文本框 - I need to change the name of a TextBox, not the text in the textbox. Then use that name to name a seperate textbox 我想在点击删除图片时显示弹出模式 - I want to show pop up modal when click on delete image
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM