8

Add a single text to a textbox, then do a cicle for for adding links

 2 years ago
source link: https://www.codeproject.com/Questions/5321220/Add-a-single-text-to-a-textbox-then-do-a-cicle-for
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Hi, I have some issues with a button click event, practically, when pressed, should paste a string (this string is a combination of"any word" and a value, that it's a result of the text from a combobox, this one will change every time the index change). I have two textbox, one where the final result it's pasted and another one where I can put the links. In summary when I press the button only this part of the code work but what's before not.

BASIC
Copy Code
<pre> For counter = 0 To tempArray.Length - 1
            tempArray(counter) = "~!" & "img(" & tempArray(counter) & ")"
        Next
        TextBox2.Lines = tempArray
        TextBox2.Text &= vbCrLf & "!~" & " ~~~"
    End Sub

The code before this
Copy Code
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim tempArray As String()
        Dim cbname As String
        tempArray = TextBox1.Lines
        cbname = ComboBox1.Text.ToString
        TextBox2.Text = "~~~img" & "(" & cbname & ")" & vbCrLf


What I have tried:
Copy Code
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim tempArray As String()
        Dim cbname As String
        tempArray = TextBox1.Lines
        cbname = ComboBox1.Text.ToString
        TextBox2.Text = "~~~img" & "(" & cbname & ")" & vbCrLf // like to put this one single time at the start of the textbox2 before starting the cicle.
        For counter = 0 To tempArray.Length - 1
            tempArray(counter) = "~!" & "img(" & tempArray(counter) & ")"
        Next
        TextBox2.Lines = tempArray
        TextBox2.Text &= vbCrLf & "!~" & " ~~~"
    End Sub

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK