?
Solved

Adding multiple values from a textbox to a label

Posted on 2005-05-14
2
Medium Priority
?
222 Views
Last Modified: 2010-04-23
hello guys

This should be very easy for most of you. I have a asp.net web page where I have a ASP text box named "txtdate" below of which I have a html button called "Add Date" next of which there is another textbox named "txtAddDate". I also have a lable named lblDate

What I need is:

1)Textbox "txtDate" should not accept more than integer 3(the maximum value a user can enter should not be more than 3)

2)When the user enters one date in "txtAddDate" and clicks on "Add Date" the date should be populated on lblDate(this is when the user enters integer 1 in txtDate)

3)When then user has entered 2 in txtdate then he should be able to add two dates into lblDate by clicking on Add Date after entering two different dates. Same case in 3 where in he can add three dates.

4) And then I can insert these dates into a table in the datebase.

Can anyone please help me in this regard?

an example with some code would be highly appreciated...

All this is regarding my job and I'm desperately in need of help.

Regards
Hardlearner
0
Comment
Question by:hardlearner
2 Comments
 

Accepted Solution

by:
TechHead earned 750 total points
ID: 14007695
1.  Private Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e AsSystem.EventArgs) Handles TextBox1.TextChanged      
         If TextBox1.Text.Length > 3 Then            
                 msgbox "Cant be more than 3"
        End If
End Sub
------------
2. Private Sub AddDate_Click( _
    ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles AddDate.Click
   
    If txtDate = 1 then
          lblDate = txtAddDate.text
    Elseif txtDate = 2 then
           lblDate = lblDate & " " & txtAddDate.text
    Elseif txtDate = 3 then
           lblDate = lblDate & " " & txtAddDate.text
    End if
End Sub
---------------
0
 

Author Comment

by:hardlearner
ID: 14009629
Hi techHead

I am going to try the same with javascript..making it a client-side validation. Improves lil bit of performance. If I cant get thru that then I'll follow urs. Thank you

Hardlearner
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 explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Integration Management Part 2
Loops Section Overview
Suggested Courses

850 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