472,780 Members | 1,233 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,780 software developers and data experts.

XML displays in console but not in text boxes

The console code is working just fine, but it isn't putting in the text
boxes.

P.S I'm using a while loop, but I'm only expecting one answer but I
haven't found a good way to process one record.

Private Sub btnFindByISBN_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnFindByISBN.Click
Dim strSearchString As String

strSearchString = "http://isbndb.com/api/books.xml?access_key="
& "CYGCL3GT" & "&index1=isbn&value1=" & Me.txtISBN.Text

Dim reader As XmlTextReader = New XmlTextReader(strSearchString)
Do While (reader.Read())
Console.WriteLine(reader.Name)
Console.WriteLine(reader.Value)

Select Case reader.Name
Case "Title"
Me.txtTitle.Text = reader.Value
Case "AuthorsText"
Me.txtAuthors.Text = reader.Value
End Select
Loop


End Sub

Visual Basic.NET 2008
Jul 3 '08 #1
3 1657
John Meyer wrote:
The console code is working just fine, but it isn't putting in the text
boxes.

P.S I'm using a while loop, but I'm only expecting one answer but I
haven't found a good way to process one record.

Private Sub btnFindByISBN_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnFindByISBN.Click
Dim strSearchString As String

strSearchString = "http://isbndb.com/api/books.xml?access_key="
& "CYGCL3GT" & "&index1=isbn&value1=" & Me.txtISBN.Text

Dim reader As XmlTextReader = New XmlTextReader(strSearchString)
Do While (reader.Read())
Console.WriteLine(reader.Name)
Console.WriteLine(reader.Value)

Select Case reader.Name
Case "Title"
Me.txtTitle.Text = reader.Value
Case "AuthorsText"
Me.txtAuthors.Text = reader.Value
End Select
Loop


End Sub

Visual Basic.NET 2008
With VB.NET 2008 you could use LINQ to XML instead of Xml(Text)Reader,
see MSDN online or your local copy:
http://msdn.microsoft.com/en-us/library/bb387098.aspx

As for your code above, with the XmlReader API you can use code like this:
Using reader As XmlReader = XmlReader.Create(strSearchString)
While reader.Read()
If reader.NodeType = XmlNodeType.Element And reader.Name =
"Title" Then
Me.txtTitle.Text = reader.ReadString()
Else if reader.NodeType = XmlNodeType.Element And reader.Name =
"AuthorsText" Then
Me.txtAuthors.Text = reader.ReadString()
End If
End While
End Using

If that does not help then show us how a sample of the XML looks.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Jul 3 '08 #2
Rack, that worked! Thanks

Martin Honnen wrote:
John Meyer wrote:
>The console code is working just fine, but it isn't putting in the text
boxes.

P.S I'm using a while loop, but I'm only expecting one answer but I
haven't found a good way to process one record.

Private Sub btnFindByISBN_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnFindByISBN.Click
Dim strSearchString As String

strSearchString = "http://isbndb.com/api/books.xml?access_key="
& "CYGCL3GT" & "&index1=isbn&value1=" & Me.txtISBN.Text

Dim reader As XmlTextReader = New XmlTextReader(strSearchString)
Do While (reader.Read())
Console.WriteLine(reader.Name)
Console.WriteLine(reader.Value)

Select Case reader.Name
Case "Title"
Me.txtTitle.Text = reader.Value
Case "AuthorsText"
Me.txtAuthors.Text = reader.Value
End Select
Loop


End Sub

Visual Basic.NET 2008

With VB.NET 2008 you could use LINQ to XML instead of Xml(Text)Reader,
see MSDN online or your local copy:
http://msdn.microsoft.com/en-us/library/bb387098.aspx

As for your code above, with the XmlReader API you can use code like this:
Using reader As XmlReader = XmlReader.Create(strSearchString)
While reader.Read()
If reader.NodeType = XmlNodeType.Element And reader.Name = "Title"
Then
Me.txtTitle.Text = reader.ReadString()
Else if reader.NodeType = XmlNodeType.Element And reader.Name =
"AuthorsText" Then
Me.txtAuthors.Text = reader.ReadString()
End If
End While
End Using

If that does not help then show us how a sample of the XML looks.
Jul 3 '08 #3
Yeah, I originally posted this in m.p.vb.general.discussion but somebody
said that I was talking Visual Basic.NET, not real Visual Basic. Go fig.
Martin Honnen wrote:
John Meyer wrote:
>The console code is working just fine, but it isn't putting in the text
boxes.

P.S I'm using a while loop, but I'm only expecting one answer but I
haven't found a good way to process one record.

Private Sub btnFindByISBN_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnFindByISBN.Click
Dim strSearchString As String

strSearchString = "http://isbndb.com/api/books.xml?access_key="
& "CYGCL3GT" & "&index1=isbn&value1=" & Me.txtISBN.Text

Dim reader As XmlTextReader = New XmlTextReader(strSearchString)
Do While (reader.Read())
Console.WriteLine(reader.Name)
Console.WriteLine(reader.Value)

Select Case reader.Name
Case "Title"
Me.txtTitle.Text = reader.Value
Case "AuthorsText"
Me.txtAuthors.Text = reader.Value
End Select
Loop


End Sub

Visual Basic.NET 2008

With VB.NET 2008 you could use LINQ to XML instead of Xml(Text)Reader,
see MSDN online or your local copy:
http://msdn.microsoft.com/en-us/library/bb387098.aspx

As for your code above, with the XmlReader API you can use code like this:
Using reader As XmlReader = XmlReader.Create(strSearchString)
While reader.Read()
If reader.NodeType = XmlNodeType.Element And reader.Name = "Title"
Then
Me.txtTitle.Text = reader.ReadString()
Else if reader.NodeType = XmlNodeType.Element And reader.Name =
"AuthorsText" Then
Me.txtAuthors.Text = reader.ReadString()
End If
End While
End Using

If that does not help then show us how a sample of the XML looks.
Jul 3 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Sunil Korah | last post by:
Hi, I have a form with just 2 text boxes to get a start date and end date to pass to a query. i have set the format to short date (which is set to "mm/dd/yy" in the regional settings of...
1
by: Ollie | last post by:
I have an aspx page that contains a web control that contains 2 text boxes and button to submit the text. I am trying to submit text and collect the response from a console application, but it is...
1
by: Max | last post by:
Hi, I am trying to paste text in a console window using SendKeys and the Clipboard (I am using Windows XP SP2 and .NET 1.1). Here is the code (I have a form with two edit boxes, DosTitle in...
11
by: Edson Peacock | last post by:
I have a report with sub reports, one of the subreports have 12 text boxes that are 2" high and I want them all to grow if one goes to 3" high. If anyone has any suggestions they are very much...
1
by: John Wright | last post by:
I am running a console application that connects to an Access database (8 million rows) and converts it to a text file and then cleans and compacts the database. When it runs I get the following...
0
by: Carl | last post by:
Hi, Does anyone know if there is a UI library for console applications, which would for example contain buttons, text boxes, lables etc for text-mode apps? regards, Carl
2
by: John Meyer | last post by:
The console code is working just fine, but it isn't putting in the text boxes. P.S I'm using a while loop, but I'm only expecting one answer but I haven't found a good way to process one record....
5
by: cs_hart | last post by:
I have a vb.net windows app that has input from two text boxes and a list box that allows one selection. I would like to convert this to a console app so I can execute it from a vb6 app and pass...
14
ollyb303
by: ollyb303 | last post by:
Hi, I am trying to create a dynamic crosstab report which will display number of calls handled (I work for a call centre) per day grouped by supervisor. I have one crosstab query (Query1) which...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.