1

the following code shows invalid qualifier when executed

Dim strs As String
Dim insStr As String
Dim strRes As String

strs = "This is VB.NET Test"
insStr = "Insert"
strRes = strs.Insert(insStr) 

2 Answers 2

3

If you look at the signature of String.Insert, you can see it takes two parameters. You have only supplied one. You need to specify what place to insert the second string into:

Dim strs As String
Dim insStr As String
Dim strRes As String
Dim index As Integer = 0

strs = "This is VB.NET Test"
insStr = "Insert"
strRes = strs.Insert(index, insStr) 
'strRes = "InsertThis is VB.NET Test"
Sign up to request clarification or add additional context in comments.

Comments

2

You forgot to say where in the string it should be inserted.

strRes = strs.Insert(strs.Length \ 2, insStr)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.