<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <Title>DateTimeFormatParse</Title>
      <Shortcut>DateTimeFormatParse</Shortcut>
      <Description>DateTimeFormatParse [VB.NET]</Description>
      <Author>behdad khoshbin</Author>
      <HelpUrl>/PreviewSnippet.aspx?SnippetID=178c83f6-f341-422a-a327-475063969c7c</HelpUrl>
      <SnippetTypes>
        <SnippetType>SurroundsWith</SnippetType>
      </SnippetTypes>
    </Header>
    <Snippet>
      <Code Language="VB"><![CDATA[    Private Sub initilizeDateBindings()
        AddHandler DteServiceBeginTextEdit.DataBindings(0).Format, AddressOf FormatDate
        AddHandler DteServiceBeginTextEdit.DataBindings(0).Parse, AddressOf ParseDate
        AddHandler DteServiceEndTextEdit.DataBindings(0).Format, AddressOf FormatDate
        AddHandler DteServiceEndTextEdit.DataBindings(0).Parse, AddressOf ParseDate
        'AddHandler DteServiceCreatedTextEdit.DataBindings(0).Format, AddressOf FormatDate
        ' AddHandler DteServiceCreatedTextEdit.DataBindings(0).Parse, AddressOf ParseDate
    End Sub

    Private Sub FormatDate(ByVal sender As Object, ByVal e As ConvertEventArgs)
        If Not (e.Value Is System.DBNull.Value) Then
            e.Value = DateConvertor.DateMiladiToStrJalali(e.Value, "yy/MM/dd")
        End If
    End Sub

    Private Sub ParseDate(ByVal sender As Object, ByVal e As ConvertEventArgs)
        Try
            e.Value = DateConvertor.strHejriToDateMiladi(e.Value)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub]]></Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>