Not sure how to do this

How to describe this:
I have a String Variable that will contain a specific string. I have another variable may or may not contain a different string that i want to use if this variable has the string instead of the first string variable.

For example:

Dim Variable1 as String

Dim Variable2 as String
Variable1 = "Test"

Variable2 = "Something Else" (Which it may or may not contain something based on user input/selection)

If Variable2.Contains = True then

Variable1 = Variable2

End If

This is not working.....Ideas

Regards,

LVB



Answer this question

Not sure how to do this

  • Kenneth Gillen

    No.

    If Variable2.Contains("Value1") Or Variable2.Contains("Value2) or Variable2.Contains("Value3") then
    Variable2 = Variable1



  • Donald E. King

    Hey guys,

    What i want to have happen is that based on user input the text within the First String Variable will be replaced with a Second String Variable.

    The use of:

    Dim Variable1 as String = "Test"
    Dim Variable2 as String = ""

    Variable2 = "[string value]"
    If Variable2.Contains("[filtering value]") then
    Variable2 = Variable1
    End if

    really wont work as the Variable2 could be one of three "types".

    I suppose I could do the following:

    If Variable2.Contains("Value1") Or ("Value2") Or ("Value3") then
    Variable2 = Variable1

    But is this proper syntax I dont know....

    LVB


  • maverick_majnoo

    I agree, it's not clear what you want to have happen.

  • lali.b

    You might need to initialize the variable first for this to work, try this:

    Dim Variable1 as String = "Test"
    Dim Variable2 as String = ""

    Variable2 = "[string value]"
    If Variable2.Contains("[filtering value]") then
    Variable2 = Variable1
    End if

    I am not sure if this is correct, because I am not entirely sure of what you are trying to do.


  • Not sure how to do this