我需要在文本框中设置输入控件 [英] I need to set control on input in textbox

查看:59
本文介绍了我需要在文本框中设置输入控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在文本框中设置控件。如果单击下一个控件或按Enter键,文本框为空。如果控件是空的,它只显示一个按钮,请输入该愿望框的文本,它不需要写丢失的焦点或按键事件或点击事件。



我尝试过:



 私有  Sub  txtEName_LostFocus(发件人作为 对象,e  As  EventArgs)句柄 txtEName.LostFocus 
如果 txtEName.Text = 然后
MsgBox( 输入员工姓名1,MsgBoxStyle.Information,strprojectname)
txtEName.Focus()
退出 Sub
Else

txtEName.BackColor = Color.White
结束 如果

结束 Sub

解决方案

使用 Control.Validating事件(System.Windows.Forms) [ ^ ]

+++++ [round 2] +++++

关注教程 [ ^ ],它在c#中,但知识是相同。

i need to set the control on text box. If the text box is empty by clicking the next control or by pressing enter key. if the control is empty its just show one massage that the "Please enter the text for that desire box" it doesn't need to write on lost focus or keypress event or on click event.

What I have tried:

Private Sub txtEName_LostFocus(sender As Object, e As EventArgs) Handles txtEName.LostFocus
        If txtEName.Text = "" Then
            MsgBox("Enter Employee Name1", MsgBoxStyle.Information, strprojectname)
            txtEName.Focus()
            Exit Sub
        Else

            txtEName.BackColor = Color.White
        End If
        
    End Sub

解决方案

Use Control.Validating Event (System.Windows.Forms)[^]
+++++[round 2]+++++
Follow this tutorial[^], it is in c#, but the knowledge is the same.


这篇关于我需要在文本框中设置输入控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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