SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 295 | Next

Scott Klein

"Professional LINQ"


Next, double-click on the form to view the code behind it, and add the following statement in the
declarations section:
Imports System.Xml.Linq
Next, behind button1, add the following highlighted code. Pay attention to what happens as you type
the code for the XML element.
Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs)
Handles Button1.Click
Dim emp As XElement = _

1
Scott
Klein
Geek

Me.TextBox1.Text = emp.ToString
End Sub
Slick, isn??™t it? The XML you typed into the Visual Basic code looks exactly like the XML fragment that
appears in the text box when you run the application and click button1:

1
Scott
Klein
Geek

How cool is that?
180
Chapter 9: LINQ to XML and Visual Basic .NET
You can even create XML documents using XML literals. To do so, simply add the highlighted code to
your XML from the previous example:
Dim emp As XElement = _


Pages:
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6