如何为TabContainer中可用的文本框设置焦点 [英] How to set the focus for the textbox that are available in TabContainer

查看:105
本文介绍了如何为TabContainer中可用的文本框设置焦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在表单中使用tabcontainer.在此,我使用了三个选项卡面板,每个选项卡面板都包含许多带有验证控件的文本框.如果任何选项卡中存在任何验证错误,则需要将重点放在该选项卡上.如何做到这一点.谁能帮我解决这个问题.

在Advance中感谢

Hi,

I am using the tabcontainer in my form. In that I am using three tab panels and each tab panel contains lots of text boxes with validation controls. If there was any validation error in any of the tab I need to set focus on that tab. How to do this one. Can any one help me to solve this problem.

Thanks in Advance

推荐答案

,您必须获取产生错误的文本框,您才能找到该框的父级,例如textbox.parent并进行类型转换来tabcontol并设置焦点..

这是一个粗略的想法,希望能解决您的问题并节省时间.
you must be getting the textbox which is producing the error, you whould be able to find the parent of that box like textbox.parent and typecast it to tabcontol and set the focus..

its a rough idea, wish it will solve your problem and save time.


您可以使用文本框上的选项卡前缀命名来根据控件的选项卡来区分控件.然后控件的父级可以选择该选项卡. 即

you may use the prefix naming of tab on textbox to diffrentiate between controls based on their tabs..secondly you can get the parent of the control then may select that tab..
i.e.

Control ctrl = txtBox.Parent
if ctrl is TabPage
{
  tbControl.SelectedTab = (TabPage) ctrl;
  txtBox.focus()
}



我认为代码应该像这样...



i think code should be some how like this...


这篇关于如何为TabContainer中可用的文本框设置焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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