Good afternoon,

I have the following entry as part of an HTA:

UserInputHTML = UserInputHTML & "<select size=" & chr(34) & "1" & chr(34) &
" name=" & chr(34) & "GrpListing" & chr(34) & " onChange=" & chr(34) &
"EnumGrpMbr(GrpListing.Value , strComputer)" & chr(34) & ">" & vbCrLf

However, this generates an error "Cannot use parenthesis when calling a
Sub". How can I fix this. I have tried different things but have not
managed to get it functional. The problem to my knowledge is with the
"EnumGrpMbr(GrpListing.Value , strComputer)" . When I have only 1 variable
to transfer to my sub it works fine, but when I tried to send 2 it gives me
this error. What is the proper synthax?

Thank you in advance!

Daniel

Re: synthax error? by Bob

Bob
Wed Nov 02 14:26:41 CST 2005

Daniel wrote:
> Good afternoon,
>
> I have the following entry as part of an HTA:
>
> UserInputHTML = UserInputHTML & "<select size=" & chr(34) & "1" &
> chr(34) & " name=" & chr(34) & "GrpListing" & chr(34) & " onChange="
> & chr(34) & "EnumGrpMbr(GrpListing.Value , strComputer)" & chr(34) &
> ">" & vbCrLf
>
> However, this generates an error "Cannot use parenthesis when calling
> a Sub". How can I fix this. I have tried different things but have
> not managed to get it functional. The problem to my knowledge is
> with the "EnumGrpMbr(GrpListing.Value , strComputer)" . When I have
> only 1 variable to transfer to my sub it works fine, but when I tried
> to send 2 it gives me this error. What is the proper synthax?
>
The error is pretty clear-cut: remove the parentheses:
"EnumGrpMbr GrpListing.Value , strComputer"

See:
http://blogs.msdn.com/ericlippert/archive/2003/09/15/52996.aspx
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.



Re: synthax error? by Daniel

Daniel
Wed Nov 02 15:17:02 CST 2005

I tried it and the variable is empty when transfered to the sub (I verified,
it is populated in the main sub...just no getting transfered properly)? I
did stop getting an error though.

Besides which, I thought that paranthesis were required when refering to a
sub? I'm confused.

Anymore advise I can try.




"Bob Barrows [MVP]" wrote:

> Daniel wrote:
> > Good afternoon,
> >
> > I have the following entry as part of an HTA:
> >
> > UserInputHTML = UserInputHTML & "<select size=" & chr(34) & "1" &
> > chr(34) & " name=" & chr(34) & "GrpListing" & chr(34) & " onChange="
> > & chr(34) & "EnumGrpMbr(GrpListing.Value , strComputer)" & chr(34) &
> > ">" & vbCrLf
> >
> > However, this generates an error "Cannot use parenthesis when calling
> > a Sub". How can I fix this. I have tried different things but have
> > not managed to get it functional. The problem to my knowledge is
> > with the "EnumGrpMbr(GrpListing.Value , strComputer)" . When I have
> > only 1 variable to transfer to my sub it works fine, but when I tried
> > to send 2 it gives me this error. What is the proper synthax?
> >
> The error is pretty clear-cut: remove the parentheses:
> "EnumGrpMbr GrpListing.Value , strComputer"
>
> See:
> http://blogs.msdn.com/ericlippert/archive/2003/09/15/52996.aspx
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>
>

Re: synthax error? by Daniel

Daniel
Wed Nov 02 15:28:02 CST 2005

In case it can help in any way below is the sub that I am trying to pass the
values to:

********
Sub EnumGrpMbr(GrpName, CmptName)
Set colGroups = GetObject("WinNT://" & CmptName & "")
colGroups.Filter = Array("group")

For Each objGroup In colGroups
If objGroup.Name = GrpName Then
For Each objUser in objGroup.Members
ProcessOutputHTML = ProcessOutputHTML & objUser.Name & vbcrlf
Next
End If
Next

ProcessOutput.InnerHTML = ProcessOutputHTML
End Sub
********



"Bob Barrows [MVP]" wrote:

> Daniel wrote:
> > Good afternoon,
> >
> > I have the following entry as part of an HTA:
> >
> > UserInputHTML = UserInputHTML & "<select size=" & chr(34) & "1" &
> > chr(34) & " name=" & chr(34) & "GrpListing" & chr(34) & " onChange="
> > & chr(34) & "EnumGrpMbr(GrpListing.Value , strComputer)" & chr(34) &
> > ">" & vbCrLf
> >
> > However, this generates an error "Cannot use parenthesis when calling
> > a Sub". How can I fix this. I have tried different things but have
> > not managed to get it functional. The problem to my knowledge is
> > with the "EnumGrpMbr(GrpListing.Value , strComputer)" . When I have
> > only 1 variable to transfer to my sub it works fine, but when I tried
> > to send 2 it gives me this error. What is the proper synthax?
> >
> The error is pretty clear-cut: remove the parentheses:
> "EnumGrpMbr GrpListing.Value , strComputer"
>
> See:
> http://blogs.msdn.com/ericlippert/archive/2003/09/15/52996.aspx
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>
>

Re: synthax error? by Bob

Bob
Wed Nov 02 22:16:26 CST 2005

Daniel wrote:
> I tried it and the variable is empty when transfered to the sub (I
> verified, it is populated in the main sub...just no getting
> transfered properly)? I did stop getting an error though.


Show us the result of
Response.Write UserInputHTML

>
> Besides which, I thought that paranthesis were required when refering
> to a sub? I'm confused.
>

Why are you confused? The error went away when you removed the parentheses
...

Read the article I linked to more closely. Read it 10 times until you
understand it

> Anymore advise I can try.
>
>
>
>
> "Bob Barrows [MVP]" wrote:
>
>> Daniel wrote:
>>> Good afternoon,
>>>
>>> I have the following entry as part of an HTA:
>>>
>>> UserInputHTML = UserInputHTML & "<select size=" & chr(34) & "1" &
>>> chr(34) & " name=" & chr(34) & "GrpListing" & chr(34) & "
>>> onChange=" & chr(34) & "EnumGrpMbr(GrpListing.Value , strComputer)"
>>> & chr(34) & ">" & vbCrLf
>>>
>>> However, this generates an error "Cannot use parenthesis when
>>> calling
>>> a Sub". How can I fix this. I have tried different things but have
>>> not managed to get it functional. The problem to my knowledge is
>>> with the "EnumGrpMbr(GrpListing.Value , strComputer)" . When I have
>>> only 1 variable to transfer to my sub it works fine, but when I
>>> tried to send 2 it gives me this error. What is the proper synthax?
>>>
>> The error is pretty clear-cut: remove the parentheses:
>> "EnumGrpMbr GrpListing.Value , strComputer"
>>
>> See:
>> http://blogs.msdn.com/ericlippert/archive/2003/09/15/52996.aspx


--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"



Re: synthax error? by Daniel

Daniel
Thu Nov 03 08:06:01 CST 2005

Thank you Bob! The article has eluminated me a great deal on this subject.
Like they say: "you learn something new every day!"

As for the output, there is none! Blank. I test the variable in the main
and it is properly populated. But when I test it in the onclick sub it is
empty? I have, for now, explicitly define the variable in the onclick sub,
but still want to fix this issue!!!

Seperate question.... Is there a way to get all the reserved names for Vbs
or Vba?

Could you give me a simple example of an HTA with an textbox and button that
once clicked passes 2 variables to a sub?!

Thank you for your help! I'm slowly getting there (I think).

Daniel





"Bob Barrows [MVP]" wrote:

> Daniel wrote:
> > I tried it and the variable is empty when transfered to the sub (I
> > verified, it is populated in the main sub...just no getting
> > transfered properly)? I did stop getting an error though.
>
>
> Show us the result of
> Response.Write UserInputHTML
>
> >
> > Besides which, I thought that paranthesis were required when refering
> > to a sub? I'm confused.
> >
>
> Why are you confused? The error went away when you removed the parentheses
> ....
>
> Read the article I linked to more closely. Read it 10 times until you
> understand it
>
> > Anymore advise I can try.
> >
> >
> >
> >
> > "Bob Barrows [MVP]" wrote:
> >
> >> Daniel wrote:
> >>> Good afternoon,
> >>>
> >>> I have the following entry as part of an HTA:
> >>>
> >>> UserInputHTML = UserInputHTML & "<select size=" & chr(34) & "1" &
> >>> chr(34) & " name=" & chr(34) & "GrpListing" & chr(34) & "
> >>> onChange=" & chr(34) & "EnumGrpMbr(GrpListing.Value , strComputer)"
> >>> & chr(34) & ">" & vbCrLf
> >>>
> >>> However, this generates an error "Cannot use parenthesis when
> >>> calling
> >>> a Sub". How can I fix this. I have tried different things but have
> >>> not managed to get it functional. The problem to my knowledge is
> >>> with the "EnumGrpMbr(GrpListing.Value , strComputer)" . When I have
> >>> only 1 variable to transfer to my sub it works fine, but when I
> >>> tried to send 2 it gives me this error. What is the proper synthax?
> >>>
> >> The error is pretty clear-cut: remove the parentheses:
> >> "EnumGrpMbr GrpListing.Value , strComputer"
> >>
> >> See:
> >> http://blogs.msdn.com/ericlippert/archive/2003/09/15/52996.aspx
>
>
> --
> Microsoft MVP - ASP/ASP.NET
> Please reply to the newsgroup. This email account is my spam trap so I
> don't check it very often. If you must reply off-line, then remove the
> "NO SPAM"
>
>
>

Re: synthax error? by Bob

Bob
Thu Nov 03 09:05:21 CST 2005

Daniel wrote:
> Thank you Bob! The article has eluminated me a great deal on this
> subject. Like they say: "you learn something new every day!"
>
> As for the output, there is none! Blank. I test the variable in the
> main and it is properly populated. But when I test it in the onclick
> sub it is empty? I have, for now, explicitly define the variable in
> the onclick sub, but still want to fix this issue!!!

Provide a small page that reproduces the problem so I can test it. Just
paste the code into your reply to this message.

>
> Seperate question.... Is there a way to get all the reserved names
> for Vbs or Vba?

They may have this documented in the MSDN library
(http://msdn.microsoft.com/library).

You can download the vbscript documentation from
http://www.microsoft.com/downloads/details.aspx?FamilyID=01592c48-207d-4be1-8a76-1c4099d7bbb9&DisplayLang=en

A quick rule of thumb is: if the word is the name of a builtin method,
object or property, then don't use the word for your user-defined methods,
objects and properties.
>
> Could you give me a simple example of an HTA with an textbox and
> button that once clicked passes 2 variables to a sub?!
>

Where are the values for the two variables supposed to come from? Whether
it's an html or hta is irrelevant. Here is an example using global variables
defined in the onload event:

<HTML>
<HEAD>
<META name=VI60_defaultClientScript content=VBScript>
<script type="text/vbscript">
dim var1, var2
Sub window_onload
var1=1: var2=2
End Sub
Sub button1_onclick(arg1, arg2)
document.getElementById("text1").value= var1 + var2
End Sub
</script>
</HEAD>
<BODY onload="window_onload">
<INPUT type="text" id=text1 name=text1>
<INPUT type="button" value="Button" id=button1 name=button1
onclick="button1_onclick var1,var2">
</BODY>
</HTML>


--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.