Solved

Textbox event

Posted on 2011-03-09
3
464 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Suggested Solutions

Title # Comments Views Activity
mapBully challenge 6 202
mapShare challenge 13 180
Windows Tool to Build Android and iOS App 3 152
Not seen Link button 5 77
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.
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

752 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