<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>RedSouljaz Blog &#187; VB.NET</title>
	<atom:link href="http://redsouljaz.com/category/programming/vb-net/feed/" rel="self" type="application/rss+xml" />
	<link>http://redsouljaz.com</link>
	<description>My Personal Blog&#039;s</description>
	<lastBuildDate>Mon, 25 Apr 2011 09:17:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>ASP.NET &#8211; GridView &#8211; Get Hidden Field Value in RowCommand</title>
		<link>http://redsouljaz.com/2010/09/21/asp-net-gridview-get-hidden-field-value-in-rowcommand/</link>
		<comments>http://redsouljaz.com/2010/09/21/asp-net-gridview-get-hidden-field-value-in-rowcommand/#comments</comments>
		<pubDate>Tue, 21 Sep 2010 10:12:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[ASP.NET - GridView - Get Hidden Field Value in RowCommand]]></category>
		<category><![CDATA[Get Hidden Field Value]]></category>
		<category><![CDATA[Get Hidden Field Value in RowCommand]]></category>
		<category><![CDATA[gridview]]></category>
		<category><![CDATA[RowCommand]]></category>

		<guid isPermaLink="false">http://redsouljaz.com/?p=346</guid>
		<description><![CDATA[There is a problem when we set BoundField visibility to false, the column isn&#8217;t rendered to the client. A work around would be to use a HiddenField within a TemplateField instead.

&#60;asp:TemplateField HeaderText=&#34;MemberID&#34;&#62;
    &#60;ItemTemplate&#62;
        &#60;asp:LinkButton ID=&#34;lbtn_memberid&#34; runat=&#34;server&#34; CommandName=&#34;GetMemberID&#34; CommandArgument='&#60;%# DataBinder.Eval(Container, &#34;DataItem.memberid&#34;) %&#62;'
     [...]]]></description>
			<content:encoded><![CDATA[<p>There is a problem when we set BoundField visibility to false, the column isn&#8217;t rendered to the client. A work around would be to use a HiddenField within a TemplateField instead.</p>
<pre class="brush: vb;">
&lt;asp:TemplateField HeaderText=&quot;MemberID&quot;&gt;
    &lt;ItemTemplate&gt;
        &lt;asp:LinkButton ID=&quot;lbtn_memberid&quot; runat=&quot;server&quot; CommandName=&quot;GetMemberID&quot; CommandArgument='&lt;%# DataBinder.Eval(Container, &quot;DataItem.memberid&quot;) %&gt;'
            Text='&lt;%# DataBinder.Eval(Container, &quot;DataItem.memberid&quot;) %&gt;'&gt;&lt;/asp:LinkButton&gt;
    &lt;/ItemTemplate&gt;
&lt;/asp:TemplateField&gt;

&lt;asp:TemplateField&gt;
    &lt;ItemTemplate&gt;
        &lt;asp:HiddenField ID=&quot;fieldid&quot; runat=&quot;server&quot; Value='&lt;%# Eval(&quot;fieldname&quot;) %&gt;' /&gt;
    &lt;/ItemTemplate&gt;
&lt;/asp:TemplateField&gt;
</pre>
<p>Back Code:</p>
<pre class="brush: vb;">
    Protected Sub gridview1_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles gridview1.RowCommand

        If e.CommandName = &quot;GetMemberID&quot; Then

            Session(&quot;GetMemberID&quot;) = e.CommandArgument.ToString()

            Dim gv As GridViewRow = DirectCast(DirectCast(e.CommandSource, LinkButton).NamingContainer, GridViewRow)

            Dim i As Integer = gv.RowIndex

            Dim row As GridViewRow = gridview1.Rows(i)

            Dim hidden As HiddenField = DirectCast(row.Cells(0).FindControl(&quot;fieldid&quot;), HiddenField)

            Dim fieldid As Integer = CInt(hidden.Value)

        End If

    End Sub
</pre>
]]></content:encoded>
			<wfw:commentRss>http://redsouljaz.com/2010/09/21/asp-net-gridview-get-hidden-field-value-in-rowcommand/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Send Email with multiple attachments from VB.NET</title>
		<link>http://redsouljaz.com/2010/06/03/send-email-with-multiple-attachments-from-vb-net/</link>
		<comments>http://redsouljaz.com/2010/06/03/send-email-with-multiple-attachments-from-vb-net/#comments</comments>
		<pubDate>Thu, 03 Jun 2010 09:43:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[MailMessage]]></category>
		<category><![CDATA[Send Email from VB.NET]]></category>
		<category><![CDATA[Send Email with attachments from VB.NET]]></category>
		<category><![CDATA[Send Email with multiple attachments from VB.NET]]></category>
		<category><![CDATA[System.Net.Mail]]></category>
		<category><![CDATA[System.Net.Mail.Attachment]]></category>

		<guid isPermaLink="false">http://redsouljaz.com/?p=328</guid>
		<description><![CDATA[This code show how to send email multiple attachments from vb.net by using System.Net.Mail
1. This is how you use it

Dim fileAttch = New ArrayList
fileAttch.Add(&#34;C:\test.csv&#34;)
fileAttch.Add(&#34;C:\test2.csv&#34;)
fileAttch.Add(&#34;C:\test3.csv&#34;)

sendEmail.send(your_emailHost, &#34;no-reply@company.com&#34;, your_EmailTo, your_EmailSubject, your_EmailBody, your_EmailccTo, fileAttch)


2. Create a class called sendEmail.vb

Imports System.IO
Imports System.Net.Mail
Imports Microsoft.VisualBasic
Imports System

Public Class sendEmail

    Public Shared Sub send(ByVal smtpHost As String, ByVal fromEmail As String, [...]]]></description>
			<content:encoded><![CDATA[<p>This code show how to send email multiple attachments from vb.net by using System.Net.Mail</p>
<p>1. This is how you use it</p>
<pre class="brush: vb;">
Dim fileAttch = New ArrayList
fileAttch.Add(&quot;C:\test.csv&quot;)
fileAttch.Add(&quot;C:\test2.csv&quot;)
fileAttch.Add(&quot;C:\test3.csv&quot;)

sendEmail.send(your_emailHost, &quot;no-reply@company.com&quot;, your_EmailTo, your_EmailSubject, your_EmailBody, your_EmailccTo, fileAttch)
</pre>
<p><script type="text/javascript"><!--
google_ad_client = "pub-6936256854341804";
google_ad_slot = "3780730535";
google_ad_width = 300;
google_ad_height = 250;
//--></script><br />
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script></p>
<p><span id="more-328"></span></p>
<p>2. Create a class called sendEmail.vb</p>
<pre class="brush: vb;">
Imports System.IO
Imports System.Net.Mail
Imports Microsoft.VisualBasic
Imports System

Public Class sendEmail

    Public Shared Sub send(ByVal smtpHost As String, ByVal fromEmail As String, ByVal toEmail As String, ByVal subject As String, ByVal body As String, ByVal cc As String, Optional ByVal AttachmentFiles As ArrayList = Nothing)
        Dim mail As New MailMessage()

        '-----------------------------------
        'Set Email Address
        '-----------------------------------
        mail.From = New MailAddress(fromEmail)

        If toEmail = &quot;&quot; Then
            Throw New Exception(&quot;Error: No email address to send&quot;)
        End If
        If toEmail.Contains(&quot;;&quot;) Then
            Dim emailList As String()
            emailList = toEmail.Split(&quot;;&quot;)
            For Each email As String In emailList
                mail.To.Add(email)
            Next
        Else
            mail.To.Add(toEmail)
        End If
        If cc &lt;&gt; &quot;&quot; Then
            If cc.Contains(&quot;;&quot;) Then
                Dim ccList As String()
                ccList = cc.Split(&quot;;&quot;)
                For Each ccTo As String In ccList
                    mail.CC.Add(ccTo)
                Next
            Else
                mail.CC.Add(cc)
            End If
        End If

        '-----------------------------------
        'Set Email Address Content
        '-----------------------------------
        mail.Subject = subject
        mail.IsBodyHtml = True
        mail.Body = body

        Dim i As Integer
        Dim Attachment As System.Net.Mail.Attachment

        For i = 0 To AttachmentFiles.Count - 1
            If FileExists(AttachmentFiles(i)) Then
                Attachment = New Net.Mail.Attachment(AttachmentFiles(i))
                mail.Attachments.Add(Attachment)
            End If
        Next

        '-----------------------------------
        'Set Email Address Host
        '-----------------------------------
        Dim smtp As New SmtpClient(smtpHost)
        Try
            smtp.Send(mail)
        Catch ex As Exception
            '-------------------------------------------------
            MsgBox(&quot;Error &quot; &amp; ex.Message)
            '-------------------------------------------------
        End Try

    End Sub

    Private Shared Function FileExists(ByVal FileFullPath As String) As Boolean
        If Trim(FileFullPath) = &quot;&quot; Then Return False

        Dim f As New IO.FileInfo(FileFullPath)
        Return f.Exists

    End Function

End Class
</pre>
]]></content:encoded>
			<wfw:commentRss>http://redsouljaz.com/2010/06/03/send-email-with-multiple-attachments-from-vb-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get first day of the month and last day of the month in VB.NET</title>
		<link>http://redsouljaz.com/2010/06/03/get-first-day-of-the-month-and-last-day-of-the-month-in-vb-net/</link>
		<comments>http://redsouljaz.com/2010/06/03/get-first-day-of-the-month-and-last-day-of-the-month-in-vb-net/#comments</comments>
		<pubDate>Thu, 03 Jun 2010 09:31:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[Finding the first and last day of the month]]></category>
		<category><![CDATA[first day of the month]]></category>
		<category><![CDATA[Get first day of the month and last day of the month in VB.NET]]></category>
		<category><![CDATA[last day of the month]]></category>

		<guid isPermaLink="false">http://redsouljaz.com/?p=325</guid>
		<description><![CDATA[This code show how to get first date of the month and last day of the month date.

Private Function GetFirstDayOfMonth(ByVal dtDate As DateTime) As DateTime
        Dim dtFrom As DateTime = dtDate
        dtFrom = dtFrom.AddDays(-(dtFrom.Day - 1))
      [...]]]></description>
			<content:encoded><![CDATA[<p>This code show how to get first date of the month and last day of the month date.</p>
<pre class="brush: vb;">
Private Function GetFirstDayOfMonth(ByVal dtDate As DateTime) As DateTime
        Dim dtFrom As DateTime = dtDate
        dtFrom = dtFrom.AddDays(-(dtFrom.Day - 1))
        Return dtFrom
    End Function

    Private Function GetLastDayOfMonth(ByVal dtDate As DateTime) As DateTime
        Dim dtTo As New DateTime(dtDate.Year, dtDate.Month, 1)
        dtTo = dtTo.AddMonths(1)
        dtTo = dtTo.AddDays(-(dtTo.Day))
        Return dtTo
    End Function

'if you put code like:
GetFirstDayOfMonth(&quot;2010-05-05&quot;) ' It will return = 2010-05-01
GetLastDayOfMonth(&quot;2010-05-05&quot;) ' It will return = 2010-05-31
</pre>
]]></content:encoded>
			<wfw:commentRss>http://redsouljaz.com/2010/06/03/get-first-day-of-the-month-and-last-day-of-the-month-in-vb-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VB.NET Set Data Table to CSV File</title>
		<link>http://redsouljaz.com/2010/06/03/vb-net-set-data-table-to-csv-file/</link>
		<comments>http://redsouljaz.com/2010/06/03/vb-net-set-data-table-to-csv-file/#comments</comments>
		<pubDate>Thu, 03 Jun 2010 09:22:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[Data Table to CSV]]></category>
		<category><![CDATA[datatable 2 csv]]></category>
		<category><![CDATA[DataTable to CSV]]></category>
		<category><![CDATA[Set Data Table to CSV File]]></category>
		<category><![CDATA[VB.NET Set Data Table to CSV File]]></category>

		<guid isPermaLink="false">http://redsouljaz.com/?p=323</guid>
		<description><![CDATA[This function show how to Convert DataTable to CSV File 

    Sub SetDataTable_To_CSV(ByVal dtable As DataTable, ByVal path_filename As String, ByVal sep_char As String)
        Dim writer As System.IO.StreamWriter
        Try
          [...]]]></description>
			<content:encoded><![CDATA[<p>This function show how to Convert DataTable to CSV File </p>
<pre class="brush: vb;">
    Sub SetDataTable_To_CSV(ByVal dtable As DataTable, ByVal path_filename As String, ByVal sep_char As String)
        Dim writer As System.IO.StreamWriter
        Try
            writer = New System.IO.StreamWriter(path_filename)

            Dim _sep As String = &quot;&quot;
            Dim builder As New System.Text.StringBuilder
            For Each col As DataColumn In dtable.Columns
                builder.Append(_sep).Append(col.ColumnName)
                _sep = sep_char
            Next
            writer.WriteLine(builder.ToString())

            For Each row As DataRow In dtable.Rows
                _sep = &quot;&quot;
                builder = New System.Text.StringBuilder

                For Each col As DataColumn In dtable.Columns
                    builder.Append(_sep).Append(row(col.ColumnName))
                    _sep = sep_char
                Next
                writer.WriteLine(builder.ToString())
            Next
        Catch ex As Exception

        Finally
            If Not writer Is Nothing Then writer.Close()
        End Try
    End Sub
</pre>
<p>This is how you use it</p>
<pre class="brush: vb;">
Dim dt As New DataTable
SetDataTable_To_CSV(dt, &quot;C:\test.csv&quot;, &quot;,&quot;)
</pre>
]]></content:encoded>
			<wfw:commentRss>http://redsouljaz.com/2010/06/03/vb-net-set-data-table-to-csv-file/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to set command Timeout for getData() in TableAdapter</title>
		<link>http://redsouljaz.com/2010/02/04/how-to-set-command-timeout-for-getdata-in-tableadapter/</link>
		<comments>http://redsouljaz.com/2010/02/04/how-to-set-command-timeout-for-getdata-in-tableadapter/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 04:26:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[Accesing CommandTimeout properties in a TableAdapter]]></category>
		<category><![CDATA[CommandTimeout property]]></category>
		<category><![CDATA[dataset]]></category>
		<category><![CDATA[How to set command Timeout for getData in TableAdapter]]></category>
		<category><![CDATA[set commandTimeout in TableAdapter]]></category>
		<category><![CDATA[TableAdapter]]></category>
		<category><![CDATA[xsd]]></category>

		<guid isPermaLink="false">http://redsouljaz.com/?p=304</guid>
		<description><![CDATA[One of the disadvantages when we using tableadapter to retrieve the data from database is they do not provide property to set command timeout (SHIT). This giving me a huge headache for my project which most of the entire project is using tableadapter instead of creating my own DAL or class.
After do some research on [...]]]></description>
			<content:encoded><![CDATA[<p>One of the disadvantages when we using tableadapter to retrieve the data from database is they do not provide property to set command timeout (SHIT). This giving me a huge headache for my project which most of the entire project is using tableadapter instead of creating my own DAL or class.<br />
After do some research on the internet, there is 1 ways to add command timeout in tableadapter dataset (.xsd file) which is</p>
<p>create new property inside partial class:<br />
Double click on xxxTableAdaper and it will show you behind code in .vb file of xsd file. Add this code inside Partial Public Class xxxDataTableAdapter</p>
<pre class="brush: vb;">
Namespace xxxTableAdapters
    Partial Public Class yyyTableAdapter
        Public WriteOnly Property CommandTimeout() As Integer
            Set(ByVal value As Integer)
                Dim i As Integer = 0
                While (i &lt; Me.CommandCollection.Length)
                    If (Me.CommandCollection(i) IsNot Nothing) Then
                        Me.CommandCollection(i).CommandTimeout = value
                    End If
                    i = (i + 1)
                End While
            End Set
        End Property
    End Class
End Namespace
</pre>
<p>And how you use it, you just add 1 line of code:</p>
<pre class="brush: vb;">
            Dim dt As New DataSet1TableAdapters.AddressTableAdapter
            dt.CommandTimeout = 120
            gridview1 = dt.GetData()
</pre>
<p>Notes:<br />
xxxTableAdapters , xxx you replace with the name of .xsd file<br />
yyyTableAdapter you replace with the name of table adapter</p>
<p>This code is tested in visual studio 2008 </p>
<p><a href="http://www.plus500.com/?id=21914&#038;pl=2&#038;tags=" target="_blank" title="Plus500"><img src="http://cdn.plus500.com/Media/Banners/728x90/439.gif" width="728" height="90" border="0" alt="Plus500" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://redsouljaz.com/2010/02/04/how-to-set-command-timeout-for-getdata-in-tableadapter/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>VB.NET Date Time Format Patterns</title>
		<link>http://redsouljaz.com/2010/01/15/vb-net-date-time-format-patterns/</link>
		<comments>http://redsouljaz.com/2010/01/15/vb-net-date-time-format-patterns/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 03:00:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[Date Time Format Patterns]]></category>
		<category><![CDATA[datetime format]]></category>
		<category><![CDATA[datetime format patterns]]></category>
		<category><![CDATA[VB.NET Date Time Format Patterns]]></category>

		<guid isPermaLink="false">http://redsouljaz.com/?p=301</guid>
		<description><![CDATA[
 Standard Format Example List:



Format
Code
Result


MM/dd/yyyy
Date.Now().ToString(&#8221;d&#8221;)
1/15/2010


dddd, dd MMMM yyyy
Date.Now().ToString(&#8221;D&#8221;)
Friday, January 15, 2010


dddd, dd MMMM yyyy hh:mm	 tt
Date.Now().ToString(&#8221;f&#8221;)
Friday, January 15, 2010 11:06 AM


dddd, dd MMMM yyyy HH:mm:ss
Date.Now().ToString(&#8221;F&#8221;)
Friday, January 15, 2010 11:06:46 AM


MM/dd/yyyy h:mm tt
Date.Now().ToString(&#8221;g&#8221;)
1/15/2010 11:06 AM


MM/dd/yyyy HH:mm:ss
Date.Now().ToString(&#8221;G&#8221;)
1/15/2010 11:06:46 AM


MMMM dd
Date.Now().ToString(&#8221;m&#8221;)
January 15


dd MMM yyyy HH&#8217;:'mm&#8217;:&#8217;ss &#8216;GMT&#8217;
Date.Now().ToString(&#8221;r&#8221;)
Fri, 15 Jan 2010 11:06:46 GMT


yyyy&#8217;-'MM&#8217;-'dd&#8217;T'HH&#8217;:'mm&#8217;:&#8217;ss
Date.Now().ToString(&#8221;s&#8221;)
2010-01-15T11:06:46


yyyy&#8217;-'MM&#8217;-'dd HH&#8217;:'mm&#8217;:&#8217;ss&#8217;Z&#8217;
Date.Now().ToString(&#8221;u&#8221;)
2010-01-15 11:06:46Z


dddd, MMMM dd yyyy HH:mm:ss
Date.Now().ToString(&#8221;U&#8221;)
Friday, January [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.plus500.com/?id=21914&#038;pl=2&#038;tags=" target="_blank" title="Plus500"><img src="http://cdn.plus500.com/Media/Banners/728x90/439.gif" width="728" height="90" border="0" alt="Plus500" /></a></p>
<div><strong> Standard Format Example List:</strong></p>
<table style="width: 100%; height: 243px;" border="1" cellspacing="1" cellpadding="1">
<tbody>
<tr>
<td class="style2"><strong><span style="font-family: Arial; font-size: x-small;">Format</span></strong></td>
<td class="style1"><strong><span style="font-family: Arial; font-size: x-small;">Code</span></strong></td>
<td><strong><span style="font-family: Arial; font-size: x-small;">Result</span></strong></td>
</tr>
<tr>
<td class="style2"><span style="font-family: Arial; font-size: x-small;">MM/dd/yyyy</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Date.Now().ToString(&#8221;d&#8221;)</span></td>
<td><span id="Label1">1/15/2010</span></td>
</tr>
<tr>
<td class="style2"><span style="font-family: Arial; font-size: x-small;">dddd, dd MMMM yyyy</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Date.Now().ToString(&#8221;D&#8221;)</span></td>
<td><span id="Label2">Friday, January 15, 2010</span></td>
</tr>
<tr>
<td class="style2"><span style="font-family: Arial; font-size: x-small;">dddd, dd MMMM yyyy hh:mm	 tt</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Date.Now().ToString(&#8221;f&#8221;)</span></td>
<td><span id="Label3">Friday, January 15, 2010 11:06 AM</span></td>
</tr>
<tr>
<td class="style2"><span style="font-family: Arial; font-size: x-small;">dddd, dd MMMM yyyy HH:mm:ss</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Date.Now().ToString(&#8221;F&#8221;)</span></td>
<td><span id="Label4">Friday, January 15, 2010 11:06:46 AM</span></td>
</tr>
<tr>
<td class="style2"><span style="font-family: Arial; font-size: x-small;">MM/dd/yyyy h:mm tt</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Date.Now().ToString(&#8221;g&#8221;)</span></td>
<td><span id="Label5">1/15/2010 11:06 AM</span></td>
</tr>
<tr>
<td class="style2"><span style="font-family: Arial; font-size: x-small;">MM/dd/yyyy HH:mm:ss</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Date.Now().ToString(&#8221;G&#8221;)</span></td>
<td><span id="Label6">1/15/2010 11:06:46 AM</span></td>
</tr>
<tr>
<td class="style2"><span style="font-family: Arial; font-size: x-small;">MMMM dd</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Date.Now().ToString(&#8221;m&#8221;)</span></td>
<td><span id="Label7">January 15</span></td>
</tr>
<tr>
<td class="style2"><span style="font-family: Arial; font-size: x-small;">dd MMM yyyy HH&#8217;:'mm&#8217;:&#8217;ss &#8216;GMT&#8217;</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Date.Now().ToString(&#8221;r&#8221;)</span></td>
<td><span id="Label8">Fri, 15 Jan 2010 11:06:46 GMT</span></td>
</tr>
<tr>
<td class="style2"><span style="font-family: Arial; font-size: x-small;">yyyy&#8217;-'MM&#8217;-'dd&#8217;T'HH&#8217;:'mm&#8217;:&#8217;ss</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Date.Now().ToString(&#8221;s&#8221;)</span></td>
<td><span id="Label9">2010-01-15T11:06:46</span></td>
</tr>
<tr>
<td class="style2"><span style="font-family: Arial; font-size: x-small;">yyyy&#8217;-'MM&#8217;-'dd HH&#8217;:'mm&#8217;:&#8217;ss&#8217;Z&#8217;</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Date.Now().ToString(&#8221;u&#8221;)</span></td>
<td><span id="Label10">2010-01-15 11:06:46Z</span></td>
</tr>
<tr>
<td class="style2"><span style="font-family: Arial; font-size: x-small;">dddd, MMMM dd yyyy HH:mm:ss</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Date.Now().ToString(&#8221;U&#8221;)</span></td>
<td><span id="Label11">Friday, January 15, 2010 3:06:46 AM</span></td>
</tr>
<tr>
<td class="style2"><span style="font-family: Arial; font-size: x-small;">yyyy MMMM</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Date.Now().ToString(&#8221;y&#8221;)</span></td>
<td><span id="Label12">January, 2010</span></td>
</tr>
</tbody>
</table>
</div>
<p><span id="more-301"></span><br />
<strong> Custom Format Examples List:</strong></p>
<table style="width: 100%;" border="1" cellspacing="1" cellpadding="1">
<tbody>
<tr>
<td class="style3"><strong><span style="font-family: Arial; font-size: x-small;">DayFormat Value</span></strong></td>
<td class="style1"><strong><span style="font-family: Arial; font-size: x-small;">Sample header</span></strong></td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">d</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">day of the month 1 &#8211; 31</span></td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">dd</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">day of the month 01 &#8211; 31</span></td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">ddd</span></td>
<td class="style1">
<p style="width: 375px;"><span style="font-family: Arial; font-size: x-small;">abbreviated name of the day of the week  (Mon, Tues, Wed etc)</span></p>
</td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">dddd</span></td>
<td class="style1">
<p style="width: 375px;"><span style="font-family: Arial; font-size: x-small;">Full name of the day of the week (Monday, Tuesday etc)</span></p>
</td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">h</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">12-hour clock hour (e.g. 9)</span></td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">hh</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">12-hour clock, with a leading 0 (e.g. 09)</span></td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">H</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">24-hour clock hour (e.g. 19)</span></td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">HH</span></td>
<td class="style1">
<p style="width: 375px;"><span style="font-family: Arial; font-size: x-small;">24-hour clock hour, with a leading 0 (e.g. 19)</span></p>
</td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">t</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Abbreviated AM / PM (e.g. A or P)</span></td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">tt</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">AM / PM</span></td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">y</span></td>
<td class="style1">
<p style="width: 375px;"><span style="font-family: Arial; font-size: x-small;">Year. eg. 2009 become 9</span></p>
</td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">yy</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Year. eg. 2009 become 09</span></td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">yyy</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Year. 2009</span></td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">yyyy</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Year. 2009</span></td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">K</span></td>
<td class="style1">
<p style="width: 293px;"><span style="font-family: Arial; font-size: x-small;">Represents the time zone information eg. +6:00</span></p>
</td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">ss</span></td>
<td class="style1">
<p style="width: 375px;"><span style="font-family: Arial; font-size: x-small;">Seconds with leading zero</span></p>
</td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">m</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Minutes</span></td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">mm</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Minutes with a leading zero</span></td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">M</span></td>
<td class="style1">
<p style="width: 375px;"><span style="font-family: Arial; font-size: x-small;">Month number 1-12</span></p>
</td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">MM</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Month number with leading zero 01-12</span></td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">MMM</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Abbreviated Month Name (Jan, Feb)</span></td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">MMMM</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Full month name (January)</span></td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">s</span></td>
<td class="style1"><span style="font-family: Arial; font-size: x-small;">Seconds</span></td>
</tr>
<tr>
<td class="style3"><span style="font-family: Arial; font-size: x-small;">ss</span></td>
<td class="style1">
<p style="width: 375px;"><span style="font-family: Arial; font-size: x-small;">Seconds with leading zero</span></p>
</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://redsouljaz.com/2010/01/15/vb-net-date-time-format-patterns/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VB.NET: How to implement Group By in DataSet using LINQ</title>
		<link>http://redsouljaz.com/2009/12/10/vb-net-how-to-implement-group-by-in-dataset-using-linq/</link>
		<comments>http://redsouljaz.com/2009/12/10/vb-net-how-to-implement-group-by-in-dataset-using-linq/#comments</comments>
		<pubDate>Thu, 10 Dec 2009 04:45:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[LINQ]]></category>
		<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[How to implement Group By in DataSet]]></category>
		<category><![CDATA[implement Group By in DataSet]]></category>
		<category><![CDATA[VB.NET: How to implement Group By in DataSet using LINQ]]></category>

		<guid isPermaLink="false">http://redsouljaz.com/?p=251</guid>
		<description><![CDATA[In this post I will show you the power of LINQ. At first I never try LINQ even when I developing project using Visual Studio 2008. But since I have no way to find a solution to one of my project, I start to explore LINQ which is give me a thought of how powerful and simple it become when doing a coding using LINQ.]]></description>
			<content:encoded><![CDATA[<p>In this post I will show you the power of LINQ. At first I never try LINQ even when I developing project using Visual Studio 2008. But since I have no way to find a solution to one of my project, I start to explore LINQ which is give me a thought of how powerful and simple it become when doing a coding using LINQ.<br />
<span id="more-251"></span><br />
So this is the case, I’m having a dataset with table SalesOrderDetail:</p>
<p><img class="alignleft size-full wp-image-252" title="LINQ1" src="http://redsouljaz.com/wp-content/uploads/2009/12/LINQ1.jpg" alt="LINQ1" width="234" height="137" /></p>
<p>And the data inside is :</p>
<p><img class="alignnone size-full wp-image-253" title="LINQ2" src="http://redsouljaz.com/wp-content/uploads/2009/12/LINQ2.jpg" alt="LINQ2" width="649" height="405" /></p>
<p>The question is, How to sum OrderQty and LineTotal based on SalesOrderID?</p>
<p>Some people might said, why don’t you just group by in store procedure or SQL Query when you calling the database. Of course than can be done easily, but what if you get this data from webservices or from csv / textfile which is make imposible to query it. This is why the LINQ comes in hand to solve this problem (Correct me if im wrong )</p>
<p>How to use LINQ for this case:</p>
<p>First:</p>
<pre class="brush: vb;">
Imports System.Linq
</pre>
<p>Second:</p>
<pre class="brush: vb;">
Public Class Form2

    Private Sub Form2_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim dt As New DataSet1TableAdapters.SalesOrderDetailTableAdapter
        Dim result = From c In dt.GetData() Group c By c.SalesOrderID Into OrderQty = Sum(c.OrderQty), LineTotal = Sum(c.LineTotal) Select SalesOrderID, OrderQty, LineTotal
        Me.DataGridView1.DataSource = result.ToList()
    End Sub

End Class
</pre>
<p>Result:<br />
<img class="alignnone size-full wp-image-254" title="LINQ3" src="http://redsouljaz.com/wp-content/uploads/2009/12/LINQ3.jpg" alt="LINQ3" width="370" height="402" /></p>
<p>So as you can see, at this line:</p>
<pre class="brush: vb;">
Dim result = From c In dt.GetData() Group c By c.SalesOrderID Into OrderQty = Sum(c.OrderQty), LineTotal = Sum(c.LineTotal) Select SalesOrderID, OrderQty, LineTotal
</pre>
<p>Result is the variable of the LINQ output, c is the variable of dt.GetData(), then you gtoup c by salesOrderID into new variable called OrderQty and so on. At the end you select the new variable that already sum / group by.</p>
<p>In order to shows the output to the datagridview, Im using result.ToList(). But there is a problem with this method, the sequnce of the column is based on alphabetical order. Even if I already set in datagridview poperties, it still back to the alphabetical sequence. I hope someone can answer this question.</p>
<p>This example is done in Visual Studio 2008.</p>
<p>If you want to see more detail about LINQ example, this is the good site:</p>
<p><a href="http://msdn.microsoft.com/en-us/vcsharp/aa336746.aspx" target="_blank">http://msdn.microsoft.com/en-us/vcsharp/aa336746.aspx</a></p>
<p>Good luck.</p>
]]></content:encoded>
			<wfw:commentRss>http://redsouljaz.com/2009/12/10/vb-net-how-to-implement-group-by-in-dataset-using-linq/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASP.NET: How to read XML Data String to Dataset</title>
		<link>http://redsouljaz.com/2009/12/02/asp-net-how-to-read-xml-data-string-to-dataset/</link>
		<comments>http://redsouljaz.com/2009/12/02/asp-net-how-to-read-xml-data-string-to-dataset/#comments</comments>
		<pubDate>Wed, 02 Dec 2009 13:54:43 +0000</pubDate>
		<dc:creator>Red Souldier</dc:creator>
				<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Convert xml to dataset]]></category>
		<category><![CDATA[dataset]]></category>
		<category><![CDATA[How to convert XML data of web service into DataSet]]></category>
		<category><![CDATA[How to read XML Data String to Dataset]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://redsouljaz.wordpress.com/?p=233</guid>
		<description><![CDATA[The output of XML String:

&#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34; ?&#62;
- &#60;NewDataSet&#62;
- &#60;Table&#62;
 &#60;CONDOM&#62;Durex&#60;/CONDOM&#62;
 &#60;SIZE&#62;XL&#60;/SIZE&#62;
 &#60;QTY&#62;123&#60;/QTY&#62;
 &#60;COLOR&#62;616&#60;/COLOR&#62;
 &#60;/Table&#62;
 &#60;/NewDataSet&#62;

In order to convert from XML to dataset, this is the code:


     Dim MyDS as new Dataset(&#34;Table1&#34;)
     Dim strReader As StringReader = New StringReader(YourXmlString)
     MyDS.ReadXml(strReader)

ad#300&#215;250]
]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript"><!--
google_ad_client = "pub-6936256854341804";
google_ad_slot = "3780730535";
google_ad_width = 300;
google_ad_height = 250;
//--></script><br />
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script></p>
<p>The output of XML String:</p>
<pre class="brush: xml;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
- &lt;NewDataSet&gt;
- &lt;Table&gt;
 &lt;CONDOM&gt;Durex&lt;/CONDOM&gt;
 &lt;SIZE&gt;XL&lt;/SIZE&gt;
 &lt;QTY&gt;123&lt;/QTY&gt;
 &lt;COLOR&gt;616&lt;/COLOR&gt;
 &lt;/Table&gt;
 &lt;/NewDataSet&gt;
</pre>
<p>In order to convert from XML to dataset, this is the code:<br />
<span id="more-233"></span></p>
<pre class="brush: vb;">
     Dim MyDS as new Dataset(&quot;Table1&quot;)
     Dim strReader As StringReader = New StringReader(YourXmlString)
     MyDS.ReadXml(strReader)
</pre>
]]></content:encoded>
			<wfw:commentRss>http://redsouljaz.com/2009/12/02/asp-net-how-to-read-xml-data-string-to-dataset/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASP.NET: Convert String XML to XML Node</title>
		<link>http://redsouljaz.com/2009/12/02/asp-net-convert-string-xml-to-xml-node/</link>
		<comments>http://redsouljaz.com/2009/12/02/asp-net-convert-string-xml-to-xml-node/#comments</comments>
		<pubDate>Wed, 02 Dec 2009 13:42:50 +0000</pubDate>
		<dc:creator>Red Souldier</dc:creator>
				<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Convert String XML to XML Node]]></category>
		<category><![CDATA[looping xmlnodelist]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[xmlNode]]></category>
		<category><![CDATA[xmlnodelist]]></category>

		<guid isPermaLink="false">http://redsouljaz.wordpress.com/?p=228</guid>
		<description><![CDATA[For example I have string value like this:

    &#60;?xml version=&#34;1.0&#34;?&#62;
           &#60;Product type=&#34;Condom&#34;&#62;
                &#60;CondomName&#62;durex&#60;/CondomName&#62;
               [...]]]></description>
			<content:encoded><![CDATA[<p>For example I have string value like this:</p>
<pre class="brush: xml;">
    &lt;?xml version=&quot;1.0&quot;?&gt;
           &lt;Product type=&quot;Condom&quot;&gt;
                &lt;CondomName&gt;durex&lt;/CondomName&gt;
                &lt;ExpDate&gt;False&lt;/ExpDate&gt;
                &lt;Type&gt;False&lt;/Type&gt;
                &lt;Color&gt;False&lt;/Color&gt;
                &lt;Qty&gt;False&lt;/Qty&gt;
            &lt;/Product&gt;
</pre>
<p>Since this this is a string value, so we need to convert to xml node to be able to process.<br />
So this is the code:<br />
<span id="more-228"></span></p>
<pre class="brush: vb;">
        Imports System.Xml
        Imports System.Xml.Serialization

        Dim xmlNodeList As System.Xml.XmlNodeList
        Dim xmlNode As System.Xml.XmlNode
        Dim XmlDoc As New XmlDocument

	Dim _condomName as String
	Dim _ExpDate as String
	Dim _Type as String
	Dim _color as String
	Dim _qty as String

        XmlDoc.LoadXml(result)
	'Select the 1st Xml Element
        xmlNodeList = XmlDoc.GetElementsByTagName(&quot;Product&quot;)
	'Because only 1 Product Element, so select index by 0
        xmlNode = xmlNodeList.Item(0)

        _condomName = xmlNode.SelectSingleNode(&quot;CondomName&quot;).InnerText
        _ExpDate = xmlNode.SelectSingleNode(&quot;ExpDate&quot;).InnerText
        _Type = xmlNode.SelectSingleNode(&quot;Type&quot;).InnerText
        _color = xmlNode.SelectSingleNode(&quot;Color&quot;).InnerText
        _qty = False 'xmlNode.SelectSingleNode(&quot;Qty&quot;).InnerText
</pre>
<p>If you have more than 1 product, you need to loop the xmlList:</p>
<pre class="brush: vb;">
For Each xmlNode As XmlNode In xmlNodeList
        _condomName = xmlNode.SelectSingleNode(&quot;CondomName&quot;).InnerText
        _ExpDate = xmlNode.SelectSingleNode(&quot;ExpDate&quot;).InnerText
        _Type = xmlNode.SelectSingleNode(&quot;Type&quot;).InnerText
        _color = xmlNode.SelectSingleNode(&quot;Color&quot;).InnerText
        _qty = False 'xmlNode.SelectSingleNode(&quot;Qty&quot;).InnerText
Next
</pre>
]]></content:encoded>
			<wfw:commentRss>http://redsouljaz.com/2009/12/02/asp-net-convert-string-xml-to-xml-node/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASP.NET: How to use Javascript alert inside AJAX UpdatePanel</title>
		<link>http://redsouljaz.com/2009/12/02/asp-net-how-to-use-javascript-alert-inside-ajax-updatepanel/</link>
		<comments>http://redsouljaz.com/2009/12/02/asp-net-how-to-use-javascript-alert-inside-ajax-updatepanel/#comments</comments>
		<pubDate>Wed, 02 Dec 2009 13:12:50 +0000</pubDate>
		<dc:creator>Red Souldier</dc:creator>
				<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[AJAX UpdatePanel]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Javascript alert inside AJAX UpdatePanel]]></category>

		<guid isPermaLink="false">http://redsouljaz.wordpress.com/?p=210</guid>
		<description><![CDATA[ 

Normally when we add Javascript Alert to our asp.net it will be like this:



Page. ClientScript.RegisterStartupScript(this.GetType(), &#34;winPop&#34;, &#34;alert('Update is successful')



but this code is not working if you using the code inside update panel.

So in order to add javascript in update panel you need to register you client script to your script manager as shown below:



ScriptManager.RegisterClientScriptBlock(Page, [...]]]></description>
			<content:encoded><![CDATA[<p><span style="font-size:small;"> </span></p>
<div id="_mcePaste">
<div id="_mcePaste">Normally when we add Javascript Alert to our asp.net it will be like this:</div>
<div></div>
<div>
<pre class="brush: css;">
Page. ClientScript.RegisterStartupScript(this.GetType(), &quot;winPop&quot;, &quot;alert('Update is successful')
</pre>
</div>
<div></div>
<div id="_mcePaste">but this code is not working if you using the code inside update panel.</div>
<div id="_mcePaste"></div>
<div id="_mcePaste">So in order to add javascript in update panel you need to register you client script to your script manager as shown below:</div>
<div id="_mcePaste"></div>
<div>
<pre class="brush: css;">
ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), Guid.NewGuid().ToString(), &quot;alert('Update is successfu.');&quot;,True)</pre>
<p></span></div>
</div>
<pre>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://redsouljaz.com/2009/12/02/asp-net-how-to-use-javascript-alert-inside-ajax-updatepanel/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

