troubleshooting Question

Is there a more simple way to set a text field in this case?

Avatar of indy500fan
indy500fan asked on
Visual Basic.NET
4 Comments1 Solution170 ViewsLast Modified:

I have the following block of code, but I am hoping there is a more simple way to set the textbox?

Here is the code:

    Private Sub SetValueOfPosition(ByVal FinalBasePayout, ByVal Position)

        Select Case Position

            Case 1
                txt1.Text = FinalBasePayout

            Case 2
                txt2.Text = FinalBasePayout

            Case 3
                txt3.Text = FinalBasePayout

           '... Repeat for Cases 4 through 29

            Case 30
                txt30.Text = FinalBasePayout
        End Select

    End Sub

There has to be a more efficient way than this method that takes over 65 lines of code!

Thanks in advance!


Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros