开始时自动选择 [英] Auto Select Upon Start
问题描述
我已经创建了一个键盘程序,虽然我遇到了一个简单的问题。
当程序启动时我想要Just Type Here!要显示在文本框上,当您单击按钮时,我希望文本替换Just Type Here。
我以为我可以写一个代码,这样当程序加载它选择文本,当文本改变时(即,当按下按钮并出现另一个字母时),则Just Type Here文字将会发生。
如果有人可以帮助我,我将非常感激。
I have created a keyboard program, though I am having one simple problem.
When the program starts I want "Just Type Here!" to appear on the textbox and when you click on a button I want the text to replace the "Just Type Here".
I was thinking I could write a code so that when the program loads it selects the text and when text changes (ie. when a button is pressed and another letter appears) then the "Just Type Here" text will go.
If someone can help me with this I will be really grateful.
推荐答案
i已经创建了一个键盘程序...
如果有人可以帮助我,我将会非常精彩
i have created a keyboard program though ...
if someone can help me with this i will be really greatfull
当然,首先尝试制作默认文本只需在此处输入
检查是否按照您的意愿设置了EnterFieldBehavior(它是文本框的属性) 。如果设置为selectAll,则设置为selectAll。当你进入文本框时,它会选择Just type here;当你输入一些它会被替换时,那将是一种快速的方式。
其他方式是在TextBox_KeyDown事件中...你可以定义一个布尔和清除如果布尔值为false,则文本框也使布尔值为true,因此只有在第一次按下键时才会清理文本框。
还有很多其他的方法。但这应该是enoug。
HTH
PS定义子外的布尔
Sure, first of all try making the default text "Just type here"
Check that the EnterFieldBehavior is set as you wish (it''s a property of the textbox). If its set "selectAll" when you enter the textbox, it''ll select "Just type here" and when you type something it''ll be replaced, that''ll be a fast way.
Other way is in the TextBox_KeyDown event...you could define a boolean and clear the text box if the boolean is false, also make the boolean true, so it''ll clean the textbox only the first time a key is pressed.
There''re many other ways. But this should be enoug.
HTH
PS define the boolean outside the sub
I我正在使用Visual Basic,我在文本框属性中找不到EnterFieldBehavior。
I am using Visual Basic and I can''t find EnterFieldBehavior in the textbox properties.
我正在使用Visual Basic而我可以''在文本框属性中找到EnterFieldBehavior。
I am using Visual Basic and I can''t find EnterFieldBehavior in the textbox properties.
我想我们需要知道什么版本的VB。
I think we need to know what version of VB.
这篇关于开始时自动选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!