forum

Home / DeveloperSection / Forums / Overwrite a string from the middle

Overwrite a string from the middle

Anonymous User 1668 11-Jun-2013
Hi Developers, 

How to create textboxes? I need to know if there is a way to replace the end of a string with the new number.

my line of code as following

    While x <= tbnumberofitems
    Dim x As Integer = 0 ' looop count '
    Dim y As Integer = 1 ' name count'
    Dim label1name As String = "label"
    Dim textbox1name As String = "textbox"
    While x <= tbnumberofitems
        y = y + 1
        If x = 0 Then y = 1
        Convert.ToString(y)
        Dim label1 As New Label
        label1.Name = label1name & y

        'Code to create label box

        Dim textbox1 As New TextBox
        textbox1.Name = textbox1name & y

        'code to create text box

        x = x + 1
    End While

This is what I currently have. What I need now is a way to make it where when the loop runs the next time, it changes the name to textbox2 and label2 on 3rd loop label 3 and textbox 3, etc. If that is not clear enough what I am trying to do is make it where the numberofitems, make it 5, creates 5 labels and 5 textboxes through the program.

Any help on above is really appreciated.


Updated on 12-Jun-2013
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By