Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Textbox event

Posted on 2011-03-09
3
Medium Priority
?
472 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 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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.
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

824 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