Solved

Textbox event

Posted on 2011-03-09
3
432 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
  • 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
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)

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now