|
-
May 2nd, 2007, 04:41 AM
#1
Thread Starter
Fanatic Member
{RESOLVED} Function output parameter ... ?
Hello....
How should i return a value from a function parameter ?
if in old VB version, i use "byref" in declaring a procedure / function parameter.
e.g :
Code:
private sub Testing(byval str1 as string, byref str2 as string)
str2 = str1 & "...just testing"
end sub
private sub command1_click()
dim tmpStr as string
call Testing("123", tmpstr)
msgbox(tmpstr)
end sub
then the str2 will function as the output parameter.
How should I do that in C# ? and how should i return the value from that output parameter.... ?
Thanks,
Last edited by Wen Lie; May 3rd, 2007 at 11:51 PM.
Reason: Problem solved :)
Regards,
[-w-]
-
May 2nd, 2007, 04:46 AM
#2
Re: Function output parameter ... ?
The better way would be to have a function that has a return value.
Code:
private string Testing(string str1)
{
return str1 + ".... just testing";
}
You can also use ref keyword to pass value types by reference, but here I would say just use a simple function that returns a value.
Use [code] source code here[/code] tags when you post source code.
My Articles
-
May 2nd, 2007, 07:30 AM
#3
Thread Starter
Fanatic Member
Re: Function output parameter ... ?
Thanks.
I've tried and it works....
-
May 2nd, 2007, 10:49 AM
#4
Fanatic Member
Re: {RESOLVED} Function output parameter ... ?
Useful Links
.Net
#Develop, GhostDoc, CodeKeep , be.PINVOKE, Good Code Snippet Site
Krypton Toolkit, XPCC / XP Common Controls, QSS Windows Forms Components
VB.COM
VB.Classic Help File, MB Controls, MZTools, ADO Stored Procedure Generator add-in,
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|