Argument Not Optional error

D

David Schenkler

I am getting an Argument Not Optional error for the following code, and I do not know why. (If you do not recognize something it is because the code comes from a different reference.)

Private Function isHeader(reqIdAsString As String) As Boolean
Dim reqId As Long
reqId = CLng(reqIdAsString)
Dim objRequirement As Requirement
Set objRequirement = objSession.getRequirement(reqId)
Dim objChildren As IStCollection
Set objChildren = objRequirement.ChildRequirements
If objChildren.count > 0 Then
Dim objUDA As UDABooleanValue
Set objUDA = objSession.Attribute
Dim objInterfaceType As IStCollection
Set objInterfaceType = objUDA.AttributeType
If objInterfaceType = "Interface Type" Then
Dim interfaceType As String
If interfaceType = "Header" Then
isHeader = True
ElseIf interfaceType = "Body" Then
isHeader = True
ElseIf interfaceType = "Trailer" Then
isHeader = True
Else
isHeader = False
End If
End If
End If

End Function
 
S

Stefan Blom

Which line raises the error?

--
Stefan Blom
Microsoft Word MVP




"David Schenkler" wrote in message

I am getting an Argument Not Optional error for the following code, and I do not
know why. (If you do not recognize something it is because the code comes from a
different reference.)

Private Function isHeader(reqIdAsString As String) As Boolean
Dim reqId As Long
reqId = CLng(reqIdAsString)
Dim objRequirement As Requirement
Set objRequirement = objSession.getRequirement(reqId)
Dim objChildren As IStCollection
Set objChildren = objRequirement.ChildRequirements
If objChildren.count > 0 Then
Dim objUDA As UDABooleanValue
Set objUDA = objSession.Attribute
Dim objInterfaceType As IStCollection
Set objInterfaceType = objUDA.AttributeType
If objInterfaceType = "Interface Type" Then
Dim interfaceType As String
If interfaceType = "Header" Then
isHeader = True
ElseIf interfaceType = "Body" Then
isHeader = True
ElseIf interfaceType = "Trailer" Then
isHeader = True
Else
isHeader = False
End If
End If
End If

End Function
 
D

David Schenkler

Which line raises the error?



--

Stefan Blom

Microsoft Word MVP









"David Schenkler" wrote in message




I am getting an Argument Not Optional error for the following code, and I do not

know why. (If you do not recognize something it is because the code comes from a

different reference.)



Private Function isHeader(reqIdAsString As String) As Boolean

Dim reqId As Long

reqId = CLng(reqIdAsString)

Dim objRequirement As Requirement

Set objRequirement = objSession.getRequirement(reqId)

Dim objChildren As IStCollection

Set objChildren = objRequirement.ChildRequirements

If objChildren.count > 0 Then

Dim objUDA As UDABooleanValue

Set objUDA = objSession.Attribute

Dim objInterfaceType As IStCollection

Set objInterfaceType = objUDA.AttributeType

If objInterfaceType = "Interface Type" Then

Dim interfaceType As String

If interfaceType = "Header" Then

isHeader = True

ElseIf interfaceType = "Body" Then

isHeader = True

ElseIf interfaceType = "Trailer" Then

isHeader = True

Else

isHeader = False

End If

End If

End If



End Function

If objInterfaceType = "Interface Type" Then
 
K

Karl E. Peterson

David Schenkler explained :
If objInterfaceType = "Interface Type" Then

You seem to be testing the default property of that object, but are
perhaps not even aware of that? (Default properties are considered
"evil" by many, exactly because of cases like this!)

Do you know what the default property is for an IStCollection object?
 
D

David Schenkler

To be honest, I do not.


David Schenkler explained :




You seem to be testing the default property of that object, but are

perhaps not even aware of that? (Default properties are considered

"evil" by many, exactly because of cases like this!)



Do you know what the default property is for an IStCollection object?



--

.NET: It's About Trust!

http://vfred.mvps.org
 
D

David Schenkler

To be honest, I don't.


David Schenkler explained :




You seem to be testing the default property of that object, but are

perhaps not even aware of that? (Default properties are considered

"evil" by many, exactly because of cases like this!)



Do you know what the default property is for an IStCollection object?



--

.NET: It's About Trust!

http://vfred.mvps.org
 
D

David Schenkler

David Schenkler explained :




You seem to be testing the default property of that object, but are

perhaps not even aware of that? (Default properties are considered

"evil" by many, exactly because of cases like this!)



Do you know what the default property is for an IStCollection object?



--

.NET: It's About Trust!

http://vfred.mvps.org




To be honest, I don't.
 
K

Karl E. Peterson

David Schenkler submitted this idea :
To be honest, I do not.

Time to find out! (Because that's what you're testing.)

I'm not being coy. I have no idea, either. But I'm not the one using
it. ;-)
 
D

David Schenkler

David Schenkler submitted this idea :




Time to find out! (Because that's what you're testing.)



I'm not being coy. I have no idea, either. But I'm not the one using

it. ;-)



--

.NET: It's About Trust!

http://vfred.mvps.org




I know that :). How do I check though?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top