Current location: Hot Scripts Forums » Programming Languages » ASP.NET » exchanging data between sub classes on same page.


exchanging data between sub classes on same page.

Reply
  #1 (permalink)  
Old 11-02-05, 05:50 PM
minority minority is offline
Wannabe Coder
 
Join Date: Jun 2005
Posts: 145
Thanks: 0
Thanked 0 Times in 0 Posts
exchanging data between sub classes on same page.

hi,

Need some advice/help....and probably some sort of tutorial.

right i am trying to do is....take a users question split it up into seperate words (DONE)
then take in a xml file and split it into seperate words and compare them.

the first part the users qquestion is done in the submit sub class which then calls a sub class knowledgebase (which splits up the xml data) and then it should compare them.

My real question is how do i take the data from the submit sub class and compare it against the knowledgebase sub class do i need to enter it into the sub class knowledgebase(here)?

here is my code for you to get an understanding it pretty simple at the moment.

Code:
<%@ Page Language="VB" ContentType="text/html" Debug="true"%>
<html>
<head>
<title>Knowledge Base Design</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<%@ Import Namespace="System.XML"%>
<%@ Import Namespace="System.IO"%>

<script language="VB" Runat="server">
Dim StrOut

Sub submit(sender As Object, e As EventArgs)
'This sub class will take the users entered question after the submit button has been pressed and split it
'into seperate words.
Dim textdelimiter as String							'Declare the variable to a string
dim aQuestion as String								'Declare the variable to a String
dim i as integer									'Declare the variable i as a integer

'Split the usersquestion into single words
aQuestion = UserQuestion.Text						'assign the question asked by the user to aquestion			
Textdelimiter = “ “									'Make the Textdelimiter look for spaces
Dim wordout = Split(aQuestion,textdelimiter)		'Split the aQuestion into seperate words and assign it to splitout

'loop through the array of splitout until it reaches the end.
for i=0 to Ubound(wordout)
lbl1.Text &= "<b>Question </b>" & i+1 & ")   " & wordout(i)& "<br>"	'print out as such split(i) splitout(i)
Next
Call KnowledgeBase()
end sub

Sub page_load(sender as object, e as EventArgs)
'Call Display_News()
End Sub

Sub KnowledgeBase()
Dim Xread as XMLTextReader = new XMLTextReader(Server.MapPath("knowledgebase.xml"))
try
While xread.Read()
Select Case xread.NodeType
Case XMLNodeType.Element

if xread.Name = "Question" then
dim questionin = xread.ReadString()
Dim textdelimiter as String							'Declare the variable to a string
dim aQuestion as String								'Declare the variable to a String
dim i as integer									'Declare the variable i as a integer

'Split the usersquestion into single words			
Textdelimiter = “ “									'Make the Textdelimiter look for spaces
Dim wordout = Split(questionin,textdelimiter)		'Split the aQuestion into seperate words and assign it to splitout

'loop through the array of splitout until it reaches the end.
for i=0 to Ubound(wordout)
lbl1.Text &= "<b>Knowledgebase </b>" & i+1 & ")   " & wordout(i)& "<br>"	'print out as such split(i) splitout(i)
next
End If 
End Select
End While
Catch ex as Exception
Response.Write("Error Happened")
Finally
xread.close()
End try
lblXML.Text = strOut
End Sub


</script>
<asp:label id="lblXML" runat="server" />

<form runat="server">
Your Question: <asp:TextBox id="UserQuestion" runat="server" />
<asp:Button OnClick="submit" Text="Submit" runat="server" />
<p><asp:Label id="lbl1" runat="server" /></p>
</form>
</body>
</html>
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Classified Ads skipper23 Perl 3 11-22-05 02:22 AM
exchanging Data pryces Script Requests 0 05-24-05 02:39 PM
Is it Possible to export data from a web page with no admin access to mySQL? phpseth PHP 1 06-04-04 10:58 AM
Classified Ads skipper23 Perl 2 12-30-03 03:43 AM


All times are GMT -5. The time now is 01:08 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.