ҡդӶ ʵŧ 纺촨շ٨絴͵ ᷹ФѺ

͵Դҷҧ Inbox Ѻ

˹ѡ
-
VB 6/VB.Net
ASP/ASP.Net
Ѻ¤
¹ҹ Flash Movie
ռͺش  
 RSS Feeds
 ǹŴ RSS Reader ...   Download  RSS Reader

Forum - www.g2gnet.com
Webmaster - www.g2gnet.com
Visitors - Session views
 5 6 1 6 1 0 9

7 ѹҤ ..2549
63 Users On-Line.
Visitors - Page views
 8 9 7 3 8 5 2
1 Ҿѹ ..2551

Google   
g2gnet.com
Ҵѡ:  

ᨡ ... Source Code ٷ͹Ź VB.Net (2008) Ѻ͡ XML

Category »  VB 6/VB.Net
: Webmaster 24/7/2551 14:01:00
(ҹ : 63747) 
㹰ҹТͧӧҹҪվẺ Freelance ФѺ ǡ Site Line ... ÷ѧ¢ .NET ѡз мͧ駹¨ҧ ١ҧ (ӷءҧ㹵ǤǹФѺ) þѲҴ VB6 ѹյ鹷عӡҷѺǼͧ ѺҨҧ ... ӡҷͧͧ Թع 件֧Ѿҡк ... ººѺ Output ͹ѹ ... ФѺ ... ˵ؼѡ ... ѧ鹡֡ͧͧ෤ .NET ֧ͧҷͧͧ Web Services ҡ ҷءѹͧѧ֡͡ҨзáѺ Web Services ͧԴҹҨеͧ¹ҹ èͧͧ XML (eXtensive Markup Language) ͹ ... ѹ˹觢ҧ˹ ... ҡѧ֡͡ա е駵 Ҩ ԡüҹ ѹ ... 55555+
¹ XML Ѻ Visual Basic 6.0 Ҥ 1
¹ XML Ѻ Visual Basic 6.0 Ҥ 2
¹ XML Ѻ Visual Basic 6.0 Ҥ 3 (ŧҧ XML HTML)
¹ XML Ѻ Visual Basic 6.0 Ҥ 4 (ᨡ鴷ٷ͹Ź VB6+XML)
ǹŴ Source Code Ѻ MS Visual Basic 2008
ǤԴ㹡͡Ẻ ... ҧ仨ҡ VB6 ¤Ѻͧ ... ҹ͡ XML Ҵ DOM (Document Object Model) Component Ѵ ListView Control ... () Դ˵ءó Mouse Double Click KeyPress ¤ Enter ... 觢 URL ҡ ListView Ѻ Windows Media Player ӧҹͧ ...
鹡кǹ÷ӧҹ

Design Time


Windows Media Player Component ҹ
dz Toolbox ... ͡ Choose Items ...


͡ Windows Media Player Component


ҡ Toolbox ͡ Windows Media Player Ҵŧ


Run Time


Imports System.Xml

Public Class frmG2GdotNetTV
    Inherits System.Windows.Forms.Form

    ' ӹdzҤҢͺͧ
    Private BorderWidth As Integer = (Me.Width - Me.ClientSize.Width) \ 2
    ' ҤҤ٧ͧ TitleBar ... ª㹡äӹdzе˹觢ͧ Control ҧ溹
    Private TitlebarHeight As Integer = Me.Height - Me.ClientSize.Height - 2 * BorderWidth

    Private Sub frmG2GdotNetTV_Load( _
        ByVal sender As System.Object, _
        ByVal e As System.EventArgs) _
        Handles MyBase.Load

        Dim XMLDoc As XmlDocument  ' ͡ XML
        Dim NodeList As XmlNodeList    ' ˹  ء Station ͧ
        ' ˹е   Station
        ' ҧ Element ѧ ID, StationName, GroupName, Media
        Dim NodeElement As XmlNode

        '  Item ҹѺ ListView
        Dim LV As New ListViewItem

        ' ҧ XML Document
        XMLDoc = New XmlDocument()

        ' Ŵ Xml 
        Dim StrAppPath As String = Environment.CurrentDirectory
        XMLDoc.Load(StrAppPath & "\g2gnettv.xml")
        ' ʶҹ͹Źҡ Web Server ... ʶҹ  ¡õҧж١ Update  ǡѹ
        'XMLDoc.Load("http://www.g2gnet.com/g2gnettv/g2gnettv.asp")

        Me.StartPosition = FormStartPosition.CenterScreen
        With lvwStation
            .Clear()
            .View = View.Details
            .FullRowSelect = True     ' ʴᶺʧǷ١ Focus
            .HideSelection = False   ' Դᶺʧ㹢з Listview ١ Focus

            .Columns.Add("ID", 0)
            .Columns.Add("ʶҹ/¡", lvwStation.Width \ 2)
            .Columns.Add("¡", lvwStation.Width \ 2 - 20)
            ' ͹ URL ҹ ... ͺ
            .Columns.Add("Media", 0)
        End With

' ˹˹ NodeList = XMLDoc.SelectNodes("tvstation/channel/Station") ' ǹͺ˹ - Station Node For Each NodeElement In NodeList ' ҹ ID Element Dim ID As String = NodeElement.ChildNodes.Item(0).InnerText ' ҹ StationName Element Dim StationName As String = NodeElement.ChildNodes.Item(1).InnerText ' ҹ GroupName Element Dim GroupName As String = NodeElement.ChildNodes.Item(4).InnerText ' ҹ Media Element - 繡纤 URL Ѻ ... ͧ Dim Media As String = NodeElement.ChildNodes.Item(2).InnerText ' ѺѴ ListView Column LV = lvwStation.Items.Add(ID) ' Index = 0 LV.SubItems.Add(StationName) ' Index = 1 LV.SubItems.Add(GroupName) ' Index = 2 LV.SubItems.Add(Media) ' Index = 3 ... ǹͧ㹡á˹ URL Ѻ Windows Media Player Next Me.Text = "G2GdotNetTV On Line - www.g2gnet.com" ' 駤Ѻ Windows Media Player WMP.enableContextMenu = False ' 顴 ͡ WMP.stretchToFit = True ' ˹Ҩ Windows Media Player ʹաѺûѺҴͧ End Sub Private Sub lvwStation_KeyPress( _ ByVal sender As Object, _ ByVal e As System.Windows.Forms.KeyPressEventArgs) _ Handles lvwStation.KeyPress ' Chr(13) ͡á Enter ͧ If e.KeyChar = Chr(13) Then Call GetURL() End Sub Private Sub lvwStation_MouseDoubleClick( _ ByVal sender As Object, _ ByVal e As System.Windows.Forms.MouseEventArgs) _ Handles lvwStation.MouseDoubleClick Call GetURL() End Sub ' ҹҨҡ Column 4 ( Index = 3) 繤 URL ListView Private Sub GetURL() Dim LV As ListViewItem If Me.lvwStation.SelectedItems.Count > 0 Then LV = Me.lvwStation.SelectedItems(0) WMP.URL = LV.SubItems(3).Text Me.Text = "G2GdotNetTV On Line - www.g2gnet.com [" & LV.SubItems(1).Text & "]" End If End Sub Private Sub frmG2GdotNetTV_Resize( _ ByVal sender As Object, _ ByVal e As System.EventArgs) _ Handles Me.Resize ' Ẻҹͧ M$ Visual Basic 6.0 СѹФѺ ... ͧ ... 55555+ With grpStation .Left = 0 .Top = Me.Height - grpStation.Height - TitlebarHeight - 8 .Width = Me.Width - 8 End With With WMP .Left = 0 .Top = 0 .Width = Me.Width .Height = Me.Height - grpStation.Height - TitlebarHeight - 8 End With With lvwStation .Left = 5 .Top = 15 .Width = grpStation.Width - 10 .Height = grpStation.Height - 22 End With End Sub End Class

͵ - g2gNet Dot Com
Ţ¹ҳԪ硷͹ԡ 0407314800231
CopyLeft © 2004 - 2099 g2gNet.Com All rights reserved.
Email: [email protected] . 08-6862-6560