yetanotherforum.net閱讀筆記,(C#)因為工作的關係,習慣了VB.net,就用VB.net寫吧(1)

來源:互聯網
上載者:User
 1Public Enum webpagesEnum webpages
 2        yet_test1
 3        yet_test2
 4        yet_m_test2
 5        yet_m_test1
 6    End Enum
 7
 8    <ToolboxData("<{0}:Forum runat=""server""></{0}:Forum>")> _
 9    Public Class class1Class class1
10        Inherits System.Web.UI.UserControl
11
12        Private Sub Forum_load()Sub Forum_load(ByVal sender As Object, ByVal e As EventArgs)
13            Dim webpages1 As webpages
14            Dim m_baseDir As String = config.ConfigSection.Item("root")
15            Try
16                webpages1 = CType([Enum ]Enum].Parse(GetType(webpages), MyBase.Request.QueryString.Item("g"), True), webpages)
17            Catch ex As Exception
18                webpages1 = webpages.yet_m_test1
19            End Try
20            Dim src As String = String.Format("{0}/{1}.ascx", m_baseDir, webpages1)
21
22            'Try
23            '    Dim webpage As ForumPage = CType(MyBase.LoadControl(src), ForumPage)
24            '    webpage.ForumControl = Me
25            '    Me.Controls.Add(webpage)
26            'Catch exception2 As System.IO.FileNotFoundException
27            '    Throw New ApplicationException(("Failed to load " & m_baseDir & "."))
28            'End Try
29
30
31
32        End Sub  1Private m_section As System.Xml.XmlNode
 2
 3        Public Sub config()Sub config(ByVal node As System.Xml.XmlNode)
 4            m_section = node
 5        End Sub
 6
 7        Public ReadOnly Property Item()Property Item(ByVal key As String) As String
 8            Get
 9                Dim node As System.Xml.XmlNode = m_section.SelectSingleNode(key)
10                If Not node Is Nothing Then
11                    Return node.InnerText
12                Else
13                    Return Nothing
14                End If
15            End Get
16        End Property
17
18        Public Shared ReadOnly Property ConfigSection()Property ConfigSection() As config
19            Get
20                Dim config1 As config = CType(ConfigurationSettings.GetConfig("yafnet"), config)
21                If (config1 Is Nothing) Then
22                    Throw New ApplicationException("Failed to get configuration from Web.config")
23                Else
24                    Return config1
25                End If
26            End Get
27        End Property

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.