如何使回车键像点击按钮一样?

编程入门 行业动态 更新时间:2024-10-28 13:22:55
本文介绍了如何使回车键像点击按钮一样?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

希望有人可以帮助我,我正在努力解决特定的问题... 我有一个包含很多标签页的表单。在一个标签页上我有一个按钮 当用鼠标点击时会将项目添加到数据网格中。当一个 用户按下此按钮上的回车键时,我希望激活鼠标点击事件 ,而是调用标签页的验证事件。 /> 我明白这种行为部分是通过设计(接受按钮 等)但我没有为我的表单设置一个接受按钮(因为 许多标签页有多个按钮,所以接受或取消 按钮是不可行的。) 简而言之 - 对于喜欢键盘和鼠标的用户 - 我想要 按一下按钮,按下按钮点击按钮点击 鼠标。 我该怎么做? (注意作为修复的一部分尝试,我已经尝试设置原因验证 为false我的按钮,以防止它调用标签页 验证事件,这不起作用 - 验证事件是 仍然触发) 非常感谢 Suzanne

解决方案

你真的不想这样做。我建议你创建一个sub / 具有你想要的功能,只需从按钮调用它,如果你 想通过鼠标点击来调用它给予控制你也可以做 。 - OHM(Terry Burns)*使用以下方法给我发电子邮件* Dim ch()As Char =" ufssz / cvsotAhsfbuTpmvujpotXjui / OFU" .ToCharArray() For i As Int32 = 0 to ch .Length - 1 ch(i)= Convert.ToChar(Convert.ToInt16(ch(i)) - 1) 下一页 Process.Start(" mailto:"& New String(ch)) - " SJ" <苏**************** @ yahoo.co.uk>在消息中写道 新闻:3d ************************* @ posting.google.co m ... 希望有人可以帮助我,我正在努力解决一个特定的问题... 我有一个包含许多标签页的表单。在一个标签页上我有一个按钮当用鼠标点击时,会将项目添加到数据网格中。当用户按下此按钮上的回车键时,我希望激活鼠标点击事件,而是调用标签页的验证事件。 我理解这种行为部分是通过设计(接受按钮等)但我没有为我的表单设置一个接受按钮(因为很多标签页有多个按钮所以接受或者取消按钮不可行。 简而言之 - 对于喜欢键盘和鼠标的用户 - 我想按一下按钮上的输入键,就像一个按钮按钮单击使用鼠标。我该怎么做? (注意作为部分尝试修复,我已经尝试将causevalidation设置为false)为我的按钮,以防止它调用标签页验证事件,这不起作用 - 验证事件仍然被触发) 非常感谢 Suzanne

搞笑!

Dim ch()As Char =" ufssz / cvsotAhsfbuTpmvujpotXjui / OFU" .ToCharArray() For i As Int32 = 0 to ch.Length - 1 ch(i)= Convert.ToChar (Convert.ToInt16(ch(i)) - 1)下一步 Process.Start(" mailto:" &安培;新字符串(ch))

相反! " Eric Sabine" < mopar41@mail_after_hot_not_before>在消息中写道 news:uz ************** @ tk2msftngp13.phx.gbl ...

搞笑!

Dim ch()As Char =" ufssz / cvsotAhsfbuTpmvujpotXjui / OFU" .ToCharArray() For i As Int32 = 0 to ch.Length - 1 ch( i)= Convert.ToChar(Convert.ToInt16(ch(i)) - 1)下一步 Process.Start(" mailto:"& New String(ch))

Hope someone can help me out there I''m struggling with a particular problem... I have a form with many tab pages. On one tab page I''ve got a button which when clicked with a mouse adds items into a datagrid. When a user presses the enter key on this button I want the mouse click event to be activated but instead the tab page''s validating event is called. I understand that this behaviour is by partly by design (Accept button etc) but I have not set an accept button for my form (because of the many tab pages there is more than one button so an accept or a cancel button is not viable). In short - for my users who prefer the keyboard to the mouse - I want an enter key press on a button to act like a button click using the mouse. How do I do this? (Note as a part attempt to fix, I''ve tried setting causesvalidation to false for my button to prevent it from calling the tab pages validating event and this did not work - the validating event was still triggered) many thanks Suzanne

解决方案

You really dont want to do this. I would suggest that you create a sub which has the functionalty you want and simply call it from the button, if you want to call it from a mouse click for a given control as well you can do that also. -- OHM ( Terry Burns ) * Use the following to email me * Dim ch() As Char = "ufssz/cvsotAhsfbuTpmvujpotXjui/OFU".ToCharArray() For i As Int32 = 0 To ch.Length - 1 ch(i) = Convert.ToChar(Convert.ToInt16(ch(i)) - 1) Next Process.Start("mailto:" & New String(ch)) -- "SJ" <su****************@yahoo.co.uk> wrote in message news:3d*************************@posting.google.co m...

Hope someone can help me out there I''m struggling with a particular problem... I have a form with many tab pages. On one tab page I''ve got a button which when clicked with a mouse adds items into a datagrid. When a user presses the enter key on this button I want the mouse click event to be activated but instead the tab page''s validating event is called. I understand that this behaviour is by partly by design (Accept button etc) but I have not set an accept button for my form (because of the many tab pages there is more than one button so an accept or a cancel button is not viable). In short - for my users who prefer the keyboard to the mouse - I want an enter key press on a button to act like a button click using the mouse. How do I do this? (Note as a part attempt to fix, I''ve tried setting causesvalidation to false for my button to prevent it from calling the tab pages validating event and this did not work - the validating event was still triggered) many thanks Suzanne

Hilarious!

Dim ch() As Char = "ufssz/cvsotAhsfbuTpmvujpotXjui/OFU".ToCharArray() For i As Int32 = 0 To ch.Length - 1 ch(i) = Convert.ToChar(Convert.ToInt16(ch(i)) - 1) Next Process.Start("mailto:" & New String(ch))

Rather! "Eric Sabine" <mopar41@mail_after_hot_not_before> wrote in message news:uz**************@tk2msftngp13.phx.gbl...

Hilarious!

Dim ch() As Char = "ufssz/cvsotAhsfbuTpmvujpotXjui/OFU".ToCharArray() For i As Int32 = 0 To ch.Length - 1 ch(i) = Convert.ToChar(Convert.ToInt16(ch(i)) - 1) Next Process.Start("mailto:" & New String(ch))

更多推荐

如何使回车键像点击按钮一样?

本文发布于:2023-07-23 07:37:23,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1195202.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:回车键   按钮

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!