Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8520221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:28:28+00:00 2026-06-11T06:28:28+00:00

Ok, I have 20 labels defined on my form and the text for these

  • 0

Ok, I have 20 labels defined on my form and the text for these labels are being blanked out when the form loads. Labels are named “LabelValue1…LabelValue20”

On the form, is a textbox where a user will enter a numeric value. Upon hitting submit, I need to populate the first available label with this numeric value. The user may enter up to 20 different values at one time and I need to populate the next label with what ever value they entered a second time and so fourth.

Is there an easier way to code this then using a huge long if else endif statement?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T06:28:29+00:00Added an answer on June 11, 2026 at 6:28 am

    While a list box would be more appropriate, if you need to do so, you can access the labels by name using the form’s Controls collection:

    Dim _currentLabel As Integer = 1
    
    Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        If _currentLabel <= 20 Then
            Dim lbl As Label = CType(Controls("LabelValue" & _currentLabel.ToString()), Label)
            lbl.Text = TextBox1.Text
            _currentLabel += 1
        End If
    End Sub
    

    To use a ListBox control, instead, you would simply need to do something like this:

    Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        If ListBox1.Items.Count < 20 Then
            ListBox1.Items.Add(TextBox1.Text)
        End If
    End Sub
    

    And then to read a particular item, you would do something like this:

    Dim secondItem As String = CStr(ListBox1.Items(1))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form element defined as: <div class=field> <div class=name> <label for=User_LastName> Last
I have 10 labels named lbl1 , lbl2 , ... lbl10 I'd like to
I have a html table column defined like this: <td> <form:checkbox cssClass=check path=somePath id=somePath
I have this strange error I don't understand. I have a model User defined
I have the following models defined in my application User Profile Address Here is
I have 10 labels on a panel - and 10 identical ClickEvents (change BackColor).
I have two labels (A and B) in a Flex VBox, with the horizontal
I have some labels that I want to allow users to edit. Is it
I have two labels that are stacked. If I want a horizontal line between
For Android I have two labels in a table row. I am trying to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.