26 VB.NET Articles - How to Decode and Encode MIME data
Viewing Article

Current Rating :

How to Decode and Encode MIME data

Thursday, April 28, 2011Posted by admin

Category:vb.Net Utilities
 

This function will decode the mime data contained in a string into a BYTE and then it can be saved onto your desktop using the FileStream. -------------------------------------------------------------------------------------------------------------------------------------------------------- Dim byteData As Byte() byteData = FromBase64(strMimeData) Dim oFileStream As System.IO.FileStream oFileStream = New System.IO.FileStream("c:\temp\" & Me.txtAttachFileName.Text, System.IO.FileMode.Create) oFileStream.Write(byteData, 0, byteData.Length) oFileStream.Close() This function will encode the data contained in a BYTE into MIME data which will be returned as a string -------------------------------------------------------------------------------------------------------------------------------------------------------------------- Public Function EncodeToBase64(ByVal data() As Byte) As String If data Is Nothing Then Throw New ArgumentNullException("data") Return Convert.ToBase64String(data) End Function This function will decode the MIME data contained in a string and the binary data will be returned as a BYTE ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Public Function DecodeFromBase64(ByVal base64 As String) As Byte() If base64 Is Nothing Then Throw New ArgumentNullException("base64") Return Convert.FromBase64String(base64) End Function

Hits:208      Current Rating :      No Of Ratings: 858      AuthorName: admin
  

Comment#23      Friday, February 11, 2011          Posted by Sumeet Singh

 
Hi this site is really great

Comment#29      Wednesday, April 04, 2012          Posted by Mike Hansen

 
The number of Saturdays or Sundays will always be 4 or 5. After much gnashing of teeth, here is the single formula that gives you the answer. iif(Today.AddDays(-Today.Day).Subtract(Today.AddDays(-Today.Day).AddMonths(-1).AddDays(4-Today.AddDays(-Today.Day).AddMonths(-1).DayOfWeek)).TotalDays/7 >

Comments

Your Name  
 
Your Email( will not appear on page)  
Your Comments