拒绝在 tabcontrol 中切换到 Tabpage [英] Deny Switching to Tabpage in a tabcontrol
问题描述
我有一个带有选项卡控件的表单(C#),它有大约五个选项卡页.
I have a form(C#) with a tab control and its has around five tab pages.
每个选项卡都有几个文本框.
each of the tab have a few textboxes.
1) 如果用户在说选项卡 A 中并编辑某些字段,我需要验证输入的文本如果发现无效,那么我不应该允许任何选项卡切换?那可能吗?
1) if a User is in say Tab A and edits certain fields i need to validate the text enetered if found invalid then i should not allow any tab switch ? is that possible?
2) 另一种情况可能是...用户编辑一些值并单击另一个选项卡,这样做时我需要检查为选项卡 A 输入的值是否正确?我可以这样做吗?
2) Another case could be ... user edits some values and clicks on another tab, on doing so i need to check if the values that were enetered for Tab A is correct or not ? can i do this?
我是 C# 的新手...所以这些问题可能听起来很基本,任何帮助将不胜感激.
I am a novice to C#... so may be these questions sound very basic any help will be appreciated.
我也想知道这些事件是什么标签页的
also i want to know what are these events of a tab page
离开、验证还是验证?
推荐答案
我遇到了类似的问题,但幸运的是我遇到了这个 MSDN 页面.只需设置一个选项卡选择事件并添加您的逻辑以在那里取消/继续.
I had a similar problem, but thankfully I came across this MSDN page. Just set up a tab selecting event and add your logic to cancel/continue there.
http://msdn.microsoft.com/en-us/library/system.windows.forms.tabcontrol.selecting.aspx
这篇关于拒绝在 tabcontrol 中切换到 Tabpage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!