VB Code:
  1. Public Class Form1
  2.     Inherits System.Windows.Forms.Form
  3.  
  4. #Region " Windows Form Designer generated code "
  5.  
  6.     Public Sub New()
  7.         MyBase.New()
  8.  
  9.         'This call is required by the Windows Form Designer.
  10.         InitializeComponent()
  11.  
  12.         'Add any initialization after the InitializeComponent() call
  13.  
  14.     End Sub
  15.  
  16.     'Form overrides dispose to clean up the component list.
  17.     Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
  18.         If disposing Then
  19.             If Not (components Is Nothing) Then
  20.                 components.Dispose()
  21.             End If
  22.         End If
  23.         MyBase.Dispose(disposing)
  24.     End Sub
  25.  
  26.     'Required by the Windows Form Designer
  27.     Private components As System.ComponentModel.IContainer
  28.  
  29.     'NOTE: The following procedure is required by the Windows Form Designer
  30.     'It can be modified using the Windows Form Designer.  
  31.     'Do not modify it using the code editor.
  32.     <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
  33.         '
  34.         'Form1
  35.         '
  36.         Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
  37.         Me.ClientSize = New System.Drawing.Size(292, 266)
  38.         Me.Name = "Form1"
  39.         Me.Text = "Form1"
  40.  
  41.     End Sub
  42.  
  43. #End Region
  44.  
  45.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  46.         'Get the value of the "showWelcomeScreen" attribute from the "start" node.
  47.         Dim startTable As IDictionary = CType(Configuration.ConfigurationSettings.GetConfig("start"), IDictionary)
  48.         Dim showWelcomeScreen As Boolean = CBool(startTable("showWelcomeScreen"))
  49.  
  50.         If showWelcomeScreen Then
  51.             MessageBox.Show("Welcome")
  52.  
  53.             Dim configDoc As New Xml.XmlDocument
  54.             Dim configPath As String = Application.ExecutablePath & ".config"
  55.  
  56.             'Load the config file into the XmlDocument
  57.             configDoc.Load(configPath)
  58.  
  59.             'Find the node that corresponds to the "start" section.
  60.             For Each node As Xml.XmlNode In configDoc("configuration")
  61.                 If node.Name = "start" Then
  62.                     'Set the "showWelcomeScreen" attribute to False for subsequent instances of the application.
  63.                     node.Attributes.GetNamedItem("showWelcomeScreen").Value = False.ToString()
  64.                     Exit For
  65.                 End If
  66.             Next
  67.  
  68.             'Save the updated config file.
  69.             configDoc.Save(configPath)
  70.         End If
  71.     End Sub
  72. End Class