Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vb programming in web parts - functions not returning anything!

Status
Not open for further replies.

colly9

Programmer
Sep 10, 2002
7
0
0
GB
OK this must be really simple:

Using Sharepoint V1
Developing web parts in MDE.
Calling a VB function.
Displaying what is returned.
THERES NOTHING THERE!

Here is the code:

Function getContent(xmlndPart)
Dim sContent
sContent = "Here is the test results: "
sContent = sContent & getReturnValue
getContent = sContent
End Function

Function getReturnValue
dim strRet

strRet = "Hello World"
getReturnValue = strRet
end Function

This just displays:
Here is the test results:

with no "Hello World" bit.

Anybody got any ideas ? This is driving me mad !
 
Your coding is not very well. You should learn to use "Return" instead of the old VB code:

Public Function getContent(byval xmlndPart as String) as String)
Dim sContent as string = ""
sContent = "Here is the test results: "
sContent = sContent + getReturnValue()
Return sContent
End Function

Public Function getReturnValue() as String
dim strRet as string = ""
strRet = "Hello World"
Return strRet
end Function

That should work!

(Note that in your sample code xmlndPart is not used)
 
Hello and thanks for the reply.

I now know what this is - its a Sharepoint web parts parsing issue.

When developing a web part, if I want to create any functions or sub routines not called GetContent or Init, then I must create a new .asp file in the "resources" folder in the workspace, and reference this file in the "dashboardextensions.vbs" file also in the resources folder.

This is sharepoint, not VB, VBS or ASP, and has its own special quirks.

I hope this helps anyone else with this problem.

Iain.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top