本文介绍了选中时清除文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我是visual studio的新用户,我想通过键盘上的Tab键选中文本框中的文本。是否有可能这样做或者是通过点击它来清除文本框的唯一选项。

I am a new user of visual studio and i wanted to make my text in the textbox clear when it is selected with the Tab button on your keyboard. Is there a possible way of doing this or is the only option to clear the textbox by clicking on it with.

这就是我现在拥有的:

private void textBox1_Click(object sender,EventArgs e)

        {

            if(textBox1.Text ==" Username")

            {

                textBox1.Clear();

            }

private void textBox1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "Username")
            {
                textBox1.Clear();
            }

但我希望它在选中时清除文本框时会清除。

but i want it that it clears when the textbox is cleared when its selected.

推荐答案

但您仍然可以使用熟悉的标签而不是水印。


这篇关于选中时清除文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 23:12
查看更多