Adding multiple values from a textbox to a label

Posted on 2005-05-14
Last Modified: 2010-04-23
hello guys

This should be very easy for most of you. I have a 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.

Question by:hardlearner

    Accepted Solution

    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

    Author Comment

    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


    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
    If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    728 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

    19 Experts available now in Live!

    Get 1:1 Help Now