如何在文本框中获得焦点 [英] how to get focus in textbox

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

问题描述

我想获得一天的工作时间
我正在使用一个datetimepicker来获取输入时间,并使用一个datetimepicker来获取退出时间.
使用这些时间,我可以通过公式退出时间-进入时间来计算总时数
我想在用户输入退出时间后立即在文本框中显示这些工作时间

我在文本框中使用了 Enter事件 ,当我在文本框中单击时可以计算并显示工作时间

是否有任何方法可以在时间选择器中输入时间,工作时间将自动显示在文本框中,而无需单击表单上的任何内容?
我可以为此使用哪个事件?

I want to get working hours of day
i m using one datetimepicker for taking entry time and one datetimepicker for taking exit time.
using these times i calculate total hours by formula Exit time-Entry time
i want to display these working hours in textbox as soon as user enters exit time

i used Enter event on textbox which calculates and displays working hours when i click in textbox

Is there any way by which as soon as enter time in timepickers, the working hours will automatically appear in textbox without any need to click anywhare on form?
which event i can use for this?

推荐答案


试试这个
Hi,
Try This
private void DateTimePicker1_ValueChanged(System.Object sender, System.EventArgs e)
{
	//Do Your CalCulation Hear and Set the value to TextBox
}


要在时间变化时触发重新计算,请处理事件DateTimePicker.ValueChanged.

-SA
As you want to trigger recalculation on change in time, handle the event DateTimePicker.ValueChanged.

—SA


为什么不使用的_blank"title =" New Window> ^ ]事件DateTimePicker [ ^ ]控件?出于好奇,这是您的个人应用程序吗?因为如果不这样做,使用datetimepicker并不是明智之举,因为人们可能会欺骗他们的登录/注销. :)
Why not use the Leave[^] event of your DateTimePicker[^] controls? Out of curiosity, is this your personal application? Because if its not, its not a wise move to use datetimepicker as people may cheat their login/logout. :)


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

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