Hi guys,
i want to add a character to the begining and the end of a multilne text box and save it into a file. e.g

1234
6789
9087

output
'1234',
'6789',
'9087'
i will appreciate the code to achieve this in vb6

Recommended Answers

All 3 Replies

Hi,
U can do parse the Text first, then apply single quotes

To Parse

Dim MyArr 
   MyArr = Split (Text1.Text, vbCrLF)

Iterate through loop and add single quotes

Dim i as Integer
  Dim newString as String

  For i = 0 To UBound(MyArr)
     newString = newString & "'" & MyArr(i) & "'" & vbCrLf
  Next
  
  Text1.Text = newString

great code.
just to correct ;)

newString = newString & "'" & MyArr(i) & "'," & vbCrLf
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.