|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Compilation errorOption Explicit On Option Strict On Imports Microsoft.VisualBasic Imports System Imports System.Xml Imports System.Text Imports System.Collections.Generic Namespace AIMLbot.AIMLTagHandlers ''' <summary> ''' The random element instructs the AIML interpreter to return exactly one of its contained li ''' elements randomly. The random element must contain one or more li elements of type ''' defaultListItem, and cannot contain any other elements. ''' </summary> Public Class random Inherits AIMLbot.Utils.AIMLTagHandler ''' <summary> ''' Ctor ''' </summary> ''' <param name="bot">The bot involved in this request</param> ''' <param name="user">The user making the request</param> ''' <param name="query">The query that originated this node</param> ''' <param name="request">The request inputted into the system</ param> ''' <param name="result">The result to be passed to the user</param> ''' <param name="templateNode">The node to be processed</param> Public Sub New(ByVal bot As AIMLbot.Bot, ByVal user As AIMLbot.User, ByVal query As AIMLbot.Utils.SubQuery, ByVal request As AIMLbot.Request, ByVal result As AIMLbot.Result, ByVal templateNode As XmlNode) MyBase.New(bot, user, query, request, result, templateNode) Me.isRecursive = False End Sub Protected Overrides Function ProcessChange() As String If Me.templateNode.Name.ToLower() = "random" Then If Me.templateNode.HasChildNodes Then ' only grab <li> nodes Dim listNodes As List(Of XmlNode) = New List(Of XmlNode)() For Each childNode As XmlNode In Me.templateNode.ChildNodes If childNode.Name = "li" Then listNodes.Add(childNode) End If Next childNode If listNodes.Count > 0 Then Dim r As New random() Dim chosenNode As XmlNode = CType(listNodes(r.Next (listNodes.Count)), XmlNode) Return chosenNode.InnerXml End If End If End If Return String.Empty End Function End Class End Namespace and I am getting the error at every Dim r as New random() Error 1 Argument not specified for parameter 'bot' of 'Public Sub New (bot As Bot, user As User, query As Utils.SubQuery, request As Request, result As Result, templateNode As System.Xml.XmlNode)'. C: \Users\smithy\Desktop\vbaiml\AIMLbot\AIMLTagHandlers\random.vb 42 29 AIMLbot any ideas Hardy Well, the only constructor I see for the Random() class is
Public Sub New(ByVal bot As AIMLbot.Bot, _ ByVal user As AIMLbot.User, _ ByVal query As AIMLbot.Utils.SubQuery, _ ByVal request As AIMLbot.Request, _ ByVal result As AIMLbot.Result, _ ByVal templateNode As XmlNode) MyBase.New(bot, user, query, request, result, templateNode) Me.isRecursive = False End Sub So the instantiation process: Dim r As New random() will fail it because the constructor says you need 6 parameters starting with "bot" parameter, hence the error. Now the Random Class also inherits AIMLbot.Utils.AIMLTagHandler so it may have a constructor with no parameters. But that doesn't seem to be the case. Overall, you need to put parameters in the instantiation statement: dim r as New Random(x1, x2, x2, x4, x5, x6) -- Show quoteHide quoteHardySpicer wrote: > The procedure is > > Option Explicit On > Option Strict On > Imports Microsoft.VisualBasic > Imports System > Imports System.Xml > Imports System.Text > Imports System.Collections.Generic > > Namespace AIMLbot.AIMLTagHandlers > ''' <summary> > ''' The random element instructs the AIML interpreter to return > exactly one of its contained li > ''' elements randomly. The random element must contain one or more li > elements of type > ''' defaultListItem, and cannot contain any other elements. > ''' </summary> > Public Class random > Inherits AIMLbot.Utils.AIMLTagHandler > ''' <summary> > ''' Ctor > ''' </summary> > ''' <param name="bot">The bot involved in this request</param> > ''' <param name="user">The user making the request</param> > ''' <param name="query">The query that originated this node</param> > ''' <param name="request">The request inputted into the system</ > param> > ''' <param name="result">The result to be passed to the user</param> > ''' <param name="templateNode">The node to be processed</param> > Public Sub New(ByVal bot As AIMLbot.Bot, ByVal user As AIMLbot.User, > ByVal query As AIMLbot.Utils.SubQuery, ByVal request As > AIMLbot.Request, ByVal result As AIMLbot.Result, ByVal templateNode As > XmlNode) > MyBase.New(bot, user, query, request, result, templateNode) > Me.isRecursive = False > End Sub > > Protected Overrides Function ProcessChange() As String > If Me.templateNode.Name.ToLower() = "random" Then > If Me.templateNode.HasChildNodes Then > ' only grab <li> nodes > Dim listNodes As List(Of XmlNode) = New List(Of XmlNode)() > For Each childNode As XmlNode In Me.templateNode.ChildNodes > If childNode.Name = "li" Then > listNodes.Add(childNode) > End If > Next childNode > If listNodes.Count > 0 Then > Dim r As New random() > Dim chosenNode As XmlNode = CType(listNodes(r.Next > (listNodes.Count)), XmlNode) > Return chosenNode.InnerXml > End If > End If > End If > Return String.Empty > End Function > End Class > End Namespace > > and I am getting the error at every Dim r as New random() > > Error 1 Argument not specified for parameter 'bot' of 'Public Sub New > (bot As Bot, user As User, query As Utils.SubQuery, request As > Request, result As Result, templateNode As System.Xml.XmlNode)'. C: > \Users\smithy\Desktop\vbaiml\AIMLbot\AIMLTagHandlers\random.vb 42 29 > AIMLbot > > > any ideas > > Hardy On May 15, 4:20 am, Mike <unkn***@unknown.tv> wrote:
Show quoteHide quote > Well, the only constructor I see for the Random() class is Ok thanks> > Public Sub New(ByVal bot As AIMLbot.Bot, _ > ByVal user As AIMLbot.User, _ > ByVal query As AIMLbot.Utils.SubQuery, _ > ByVal request As AIMLbot.Request, _ > ByVal result As AIMLbot.Result, _ > ByVal templateNode As XmlNode) > MyBase.New(bot, user, query, request, result, templateNode) > Me.isRecursive = False > End Sub > > So the instantiation process: > > Dim r As New random() > > will fail it because the constructor says you need 6 parameters > starting with "bot" parameter, hence the error. > > Now the Random Class also inherits AIMLbot.Utils.AIMLTagHandler so it > may have a constructor with no parameters. > > But that doesn't seem to be the case. > > Overall, you need to put parameters in the instantiation statement: > > dim r as New Random(x1, x2, x2, x4, x5, x6) > > -- > > HardySpicer wrote: > > The procedure is > > > Option Explicit On > > Option Strict On > > Imports Microsoft.VisualBasic > > Imports System > > Imports System.Xml > > Imports System.Text > > Imports System.Collections.Generic > > > Namespace AIMLbot.AIMLTagHandlers > > ''' <summary> > > ''' The random element instructs the AIML interpreter to return > > exactly one of its contained li > > ''' elements randomly. The random element must contain one or more li > > elements of type > > ''' defaultListItem, and cannot contain any other elements. > > ''' </summary> > > Public Class random > > Inherits AIMLbot.Utils.AIMLTagHandler > > ''' <summary> > > ''' Ctor > > ''' </summary> > > ''' <param name="bot">The bot involved in this request</param> > > ''' <param name="user">The user making the request</param> > > ''' <param name="query">The query that originated this node</param> > > ''' <param name="request">The request inputted into the system</ > > param> > > ''' <param name="result">The result to be passed to the user</param> > > ''' <param name="templateNode">The node to be processed</param> > > Public Sub New(ByVal bot As AIMLbot.Bot, ByVal user As AIMLbot.User, > > ByVal query As AIMLbot.Utils.SubQuery, ByVal request As > > AIMLbot.Request, ByVal result As AIMLbot.Result, ByVal templateNode As > > XmlNode) > > MyBase.New(bot, user, query, request, result, templateNode) > > Me.isRecursive = False > > End Sub > > > Protected Overrides Function ProcessChange() As String > > If Me.templateNode.Name.ToLower() = "random" Then > > If Me.templateNode.HasChildNodes Then > > ' only grab <li> nodes > > Dim listNodes As List(Of XmlNode) = New List(Of XmlNode)() > > For Each childNode As XmlNode In Me.templateNode.ChildNodes > > If childNode.Name = "li" Then > > listNodes.Add(childNode) > > End If > > Next childNode > > If listNodes.Count > 0 Then > > Dim r As New random() > > Dim chosenNode As XmlNode = CType(listNodes(r.Next > > (listNodes.Count)), XmlNode) > > Return chosenNode.InnerXml > > End If > > End If > > End If > > Return String.Empty > > End Function > > End Class > > End Namespace > > > and I am getting the error at every Dim r as New random() > > > Error 1 Argument not specified for parameter 'bot' of 'Public Sub New > > (bot As Bot, user As User, query As Utils.SubQuery, request As > > Request, result As Result, templateNode As System.Xml.XmlNode)'. C: > > \Users\smithy\Desktop\vbaiml\AIMLbot\AIMLTagHandlers\random.vb 42 29 > > AIMLbot > > > any ideas > > > Hardy "HardySpicer" wrote: ....> The procedure is > > Option Explicit On > Option Strict On > If listNodes.Count > 0 Then ....> Dim r As New random() > any ideas Are you intending to call new System.Random() or new > > Hardy > AIMLbot.AIMLTagHandlers.Random()? I actually get the error on the next line where r.Next(...) is used. Mike
Cannot update Access Database
Get url for pdf file from AxSHDocVw.AxWebBrowser Attribute wanted how to remove a programmatically created DateTimePicker Application development pointers How to add control/component to the IDE toolbar Resizing the click area of a checkbox. why not inherit from type 'b(Of a)' Structures inside structures Convert an untyped Data Table to a typed Data Table |
|||||||||||||||||||||||