自动完成框的焦点事件
问题描述:
大家好
任何人都可以告诉我如何在加载时将焦点设置在自动完成框上..
谢谢你
Hi all
Can anyone tell me how to set focus on a autocomplete box while load..
Thank you
答
这听起来不是很明显所以贬低你的问题并没有尝试过对于他们自己。
显而易见的解决方案是使用类似
This isn''t as obvious as it may sound so it''s a shame whoever downvoted your question didn''t try it out for themselves.
The "obvious" solution is to use something like
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.TextBox1.Focus()
End Sub
但是你会问uickly发现,这不起作用,因为标签顺序将接管。
你有几个选择...
But as you''ll quickly find out, that doesn''t work as the tab order will "take over".
You have a couple of options ...
Me.TextBox1.TabIndex = 0
或
or
Me.TextBox1.Select()
将同时工作
Tabindex无法在该控件上运行 - 尝试确保自动填充框是XAML中列出的第一个控件,并且tabindex为任何控件设置 not