Dim a value that has called a function

Discussion in 'C#' started by mr_tim, May 13, 2008.

  1. #1
    I have a form that submits a value. I need to perform several calculations on this value so I Dim it from the start. e.g.
    
    Dim MyValue
    MyValue = request.form("MyValue")
    
    Code (markup):
    Trouble is I need to call a function to strip rogue characters from it.
    Call StripChar(MyValue)
    Code (markup):
    Is there a simple way to dim this so i don't have to repeatedly use Call StripChar(MyValue) each time i refer to it?

    
    Dim MyValue
    MyValue = Call StripSpecialChar(MyValue)
    
    Code (markup):
    Doesn't work... Thanks!
     
    mr_tim, May 13, 2008 IP
  2. dgxshiny

    dgxshiny Greenhorn

    Messages:
    65
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    23
    #2
    If it is a function you should not be using the Call statement.

    Try:

    
    Dim MyValue
    MyValue = request.form("MyValue")
    MyValue = StripSpecialChar(MyVaue)
    Code (markup):
     
    dgxshiny, May 13, 2008 IP
  3. itcn

    itcn Well-Known Member

    Messages:
    795
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    118
    #3
    Yeah, no need for call:

    
    Dim MyValue
    MyValue = StripSpecialChar(request.form("MyValue"))
    
    Code (markup):
    And you do have to reference the function each time.
     
    itcn, May 15, 2008 IP