Results 1 to 8 of 8

Thread: Strings as parameters

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2004
    Location
    Brazil
    Posts
    10

    Strings as parameters

    Dear all,

    I would like to pass a string as parameter to a form that would modify it. Then, as a result, I would like, when finish the form, to change this variable.

    Observe that the I will need to access the parameter in many subs and functions before it is ready to be returned.

    I am thinking use pointers to this string to have how to modify it?
    How can I do it?

    If I pass a Label.Caption as parameter, could I modify it on a function?

    Thanks in advance,
    Nizam

  2. #2
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    Why did you post the same post twice?
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2004
    Location
    Brazil
    Posts
    10
    I didn't know that VBForums and VBExtreme was the same site and I was wanting to publish my doubt in many places to have a fast answer. Do u know how to solve this problem frd?

  4. #4
    Hyperactive Member
    Join Date
    Nov 2003
    Location
    In Front of my computer...
    Posts
    367
    i didnt understand your problem exactly but maybe you mean this...
    If I pass a Label.Caption as parameter, could I modify it on a function?
    Label.Caption = sCaption

    then sCaption variable can be changed in a function or sub you just need to declare it at very top of your code in Declarations area... -.- or module.......
    Born to help others
    (If I've been helpful then please rate my post. Thanks)

    call me EJ or be slapped!

  5. #5

    Thread Starter
    New Member
    Join Date
    Jul 2004
    Location
    Brazil
    Posts
    10
    But when I do this and change sCaption I will not change Label1.Caption, will I?
    Actually I would like my form woks like a function.

  6. #6
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    Originally posted by nizam
    I didn't know that VBForums and VBExtreme was the same site and I was wanting to publish my doubt in many places to have a fast answer. Do u know how to solve this problem frd?
    I meant this: http://www.vbforums.com/showthread.p...hreadid=302417

    Anyways, usually you would use ByRef, but apparently you can't for the Caption property. You can still do something like this though:
    VB Code:
    1. private sub Whatever(byval SomeStr as String)
    2. SomeStr="hello"
    3. end sub
    4.  
    5. 'in another procedure
    6. dim tmp as string
    7.  
    8. tmp=Label1.Caption
    9. whatever tmp
    10. Label1.Caption=tmp
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  7. #7

    Thread Starter
    New Member
    Join Date
    Jul 2004
    Location
    Brazil
    Posts
    10
    ByRef or ByVal? Because I want to pass the reference as parameter and not the value, right?

  8. #8
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132
    Dbl posting is a bad habit.
    Read my reply to your other thread.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width