Regards Visakh Reply Jan Philipp Giel says: December 11, 2006 at 5:17 am I am a bit confused right now. In VS2010 vb.net I’m getting an error with a script Microsoft VBScript compilation error: Cannot use parentheses when calling a Sub Line 54, Column 76, oReg.GetStringValue(HKEY_LOCAL_MACHINE, strKeyPath, strValueName, strValue) The line For example: Result = MyFunc(MyArg) An argument list for a subroutine call, or a function call with no assignment, that uses the Call keyword must be surrounded by parentheses. All rights reserved. check over here
See ByRef and ByVal in VBScript for details. –Helen Oct 14 '14 at 13:38 add a comment| up vote 0 down vote Seems to me this is a VB.NET, not VBScript Now it should be clear why the statementMySub(MyArg) is legal but MyOtherSub(MyArg1, MyArg2) is not. For example: Limit = UBound(MyArray) or… Pass an argument which would normally be ByRef as ByVal. Is it possible to sheathe a katana as a free action?
Should I report it? Set WshShell = WScript.CreateObject("WScript.Shell") WshShell.Run(iexplore -k http://support.microsoft.com/kb/154780, 1, true) Reply JoeNo1 says: December 4, 2009 at 3:21 pm This has been always confusing for me. why does this error keep popping out? This was driving me crazy... –Mentok Apr 28 '14 at 21:05 add a comment| up vote 1 down vote See this article from Eric Lippert.
WITH the fixed code, that now triggered the errors way down in lines 511- 513…. Unfortunately, VB and hence VBScript has some weird rules about when #3 applies. How to handle a common misconception when writing a Master's thesis? Expected End Of Statement Professor Lewin: "Which string will break?" / Me: "That one." / Professor Lewin: "Wrong!" Lab colleague uses cracked software.
Or is there something I'm missing with the no arguments scenario? Cannot Use Parentheses When Calling A Sub Msgbox Contact Us Web Developer Forum Top Powered by vBulletin Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. Code: test123 = UpdateContactBK(StrContactNo,ObjTrack,pd(DAY(date()),2) & " " & MonthName(2,true) & " " & YEAR(date()),"TrainAcc") Moderator @ WebDeveloper.com Reply With Quote 02-08-2012,03:33 PM #4 fredmv View Profile View Forum Posts Moderator Join Change: MyOtherSub(MyArg1, MyArg2) To: Call MyOtherSub(MyArg1, MyArg2) Or: MyOtherSub MyArg1, MyArg2 Reply Bao says: November 11, 2011 at 3:22 pm Great explaination…it was confusing to me why passing 1 argument with
Are keywords in resolv.conf case sensitive? Vbscript Function Return Boss sends a birthday message. I had 2 arguments and was calling a sub from an onClick and was getting the error At lines 511-513. 8 pages with the same code. I can't thank you enough for clearing that up for me - been looking like a fool in front of new collueges for hours until I stumbled upon this site.
Reply Eric Lippert says: September 16, 2003 at 7:24 pm I live to serve! http://rinfix.com/cannot-use/vbscript-replace-cannot-use-parentheses.html Are you aComputer / IT professional?Join Tek-Tips Forums! Missing } inserted. \int dx = x + C & How to stop NPCs from picking up dropped items Why does Cutie act like this and lesser robots listen to it? How to reduce the width of the equation in a text paragraph? 800a0414
This means that in VB.NET, the statement MySub(MyArg) has different semantics than it does in VBScript and VB6 -- this will pass MyArg byref in VB.NET, byval in VBScript/VB6. In fact, it is a subroutine call with no parentheses around the argument list, but parentheses around the first argument. Here's the deal: parentheses mean several different things in VB and hence in VBScript. this content However, the compiler doesn't seem to like the red line.
If it applies, does it overrides default behavior and/or coded behavior? Vbs Object Required Then why is it legal? In case it's not clear, the inner call of "test" in the last statement is valid because its return value is used as an argument to another call.
This post was powered by : Reply With Quote Oct 5th, 2004,11:26 AM #3 Disiance View Profile View Forum Posts Visit Homepage Thread Starter Hyperactive Member Join Date Sep 2004 Location more stack exchange communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed Worked for me. If Condition In Vbscript Forum New Posts FAQ Calendar Forum Actions Mark Forums Read Quick Links Today's Posts View Site Leaders What's New?
now, the funny part is, that before when I had the code WRONG in those same lines, they worked quite fine and no errors.