Solved

Textbox event

Posted on 2011-03-09
3
467 Views
Last Modified: 2012-05-11
I ahve textbox  and label .I do have form.having 7 textbox with 7 label.

 Firstname : textboxfirstname
LAstname :textboxlastname
ETC.
Enter button.(Image button)
what I am trying to do is if any of the upper field is empty and anyone click the imagebutton than Label should turn into red and text into white.

then when someone add the text inside that and click anywhere or put the curser in nextbox the previous label have to becomes white again.

Can anyone pelase help me out.
0
Comment
Question by:itgirl7
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 11

Expert Comment

by:Deepak Lakkad
ID: 35090117
You have yo write two events
1st for Image button, where you will check if textbox is empty then change font color of associated label e.g. Label1 is associated with TextBox1 then you will write code as below:
IF textbox1.text = "" Then
   Label1.BackColor = Color.Red
   Label1.ForeColor = Color.White
End If

Open in new window


same way you can code for other textboxes ...

2nd is Validate Event for TextBox ... The code snippnet is given below:
Label1.BackColor = Color.White ' or your original Back Color
Label1.ForeColor = Color.Black  ' or your original Fore Color

Open in new window


- Deepak Lakkad

0
 

Author Comment

by:itgirl7
ID: 35090228
Can you please let me know in which event I have to write.
0
 
LVL 11

Accepted Solution

by:
Deepak Lakkad earned 500 total points
ID: 35091957
Use Button.Click event for first code snippet and TextBox.Leave or TextBox.Validate for second code

- Deepak Lakkad

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question