Advertisement
Guest User

Untitled

a guest
Sep 15th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.70 KB | None | 0 0
  1. Imports System.Xml
  2. Imports System.Linq
  3.  
  4.  
  5. Public Class Form1
  6.     Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  7.         Dim xdoc = <?xml version="1.0" encoding="utf-8" standalone="yes"?>
  8.                    <Table>
  9.                        <Settings>
  10.                            <Main_Title>Test Launcher</Main_Title>
  11.                            <Product_name>Product 1</Product_name>
  12.                            <Product_price>1000</Product_price>
  13.                        </Settings>
  14.                        <Settings>
  15.                            <Product_id>2</Product_id>
  16.                            <Product_name>Product 2</Product_name>
  17.                            <Product_price>2000</Product_price>
  18.                        </Settings>
  19.                        <Settings>
  20.                            <Product_id>3</Product_id>
  21.                            <Product_name>Product 3</Product_name>
  22.                            <Product_price>3000</Product_price>
  23.                        </Settings>
  24.                        <Settings>
  25.                            <Product_id>4</Product_id>
  26.                            <Product_name>Product 4</Product_name>
  27.                            <Product_price>4000</Product_price>
  28.                        </Settings>
  29.                    </Table>
  30.  
  31.         Dim query =
  32.             (
  33.                 From T
  34.                 In xDoc...<Settings>
  35.                 Select Title = T.<Main_Title>.Value, Name = T.<Product_name>.Value, Price = T.<Product_price>.Value
  36.             ).
  37.             ToList
  38.  
  39.         For Each Item In query
  40.             MessageBox.show($"[{Item.title}] [{Item.name}] [{Item.price}]", Item.price)
  41.         Next
  42.     End Sub
  43. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement