如何按下"Enter Key"将数据发送到数据库? [英] how to send data to a database on the press of the "Enter Key"

查看:103
本文介绍了如何按下"Enter Key"将数据发送到数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
我想按"Enter键"将数据发送到数据库.
谢谢

hello,
i want to send data to a database on the press of the "Enter Key".
Thanks

推荐答案

您需要了解"Enter Key"的作用!提交表格.单击表单上的按钮时,需要将其表单数据发送到数据库(在按钮Click处理程序中保存数据的代码).现在,只要您的按钮具有焦点,按Enter就会自动提交调用click事件处理程序的表单.

尝试!
You need to understand what does an ''Enter Key'' do! It submits the form. You need to have a button on your form on click of which data of the form can be sent to database (code for saving data in the button Click handler). Now, as long as your button has focus, pressing enter will automatically submit the form calling the click event handler.

Try!


您可以用几种不同的方法来执行此操作,如果表单中有一个默认按钮,那么ENTER键将自动按该按钮(作为Windows的默认行为).然后,您可以控制单击该按钮的事件,并在其中插入更新数据库*.
所需的所有代码.
如果您不修改该行为,此解决方案将关闭对话框(默认情况下).

如果没有默认按钮,则可能有兴趣捕获按下的键WM_KEYDOWN或WM_KEYUP(可能更好)并处理该事件(消息).


您还可以通过KeyPress和KeyUp处理Enter键的按下...在google"keyup vb.net"中搜索它们,您将获得更多信息.


希望这能使您走上道路的第一步.如果您需要进一步的帮助,请回来...肯定有人会为您提供帮助.

*请注意,您尚未指定要使用的数据库.两种都不希望将应用程序与数据库连接.无论数据的种类和存储位置...
You can do that in several different ways, if you have a default button in your form then ENTER key will automatically press that button (as the default Windows behavior). Then you can control the event of clicking that button and insert there all the code needed to update the database *.

This solution will close the dialog (by default) if you don''t modify that behavior.

If you don''t have a default button, then you could be interested in capturing the key pressed WM_KEYDOWN or WM_KEYUP (probably better) and handling that event (message).


You can also handle the press of the enter key by KeyPress and KeyUp... search for them in google "keyup vb.net" and you''ll get more information.


Hope this puts you at the beginning of the path... come back when you need further help... somebody will help you for sure.

* Notice that you''ve not specified which database are you using. Neither the way you want to connect your app with the database. Naither the kind of data and where it is stored...


这篇关于如何按下"Enter Key"将数据发送到数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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