FREE VB.NET SOURCE CODE

24 April, 2012

[SNP] Convert Image / PictureBox Image / Bitmap to string / text [VB.NET]

I am sorry for the long delay, but here we go again !

A code to convert your bitmap/picturebox image to string and another one to reverse it.

But you must: Imports System.IO first ;)

 Public Function BitmapToString(ByVal bImage As Bitmap) As String
        Try
            Dim data As String
            Dim ms As MemoryStream = New MemoryStream
            bImage.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg)
            data = Convert.ToBase64String(ms.ToArray())

            Return data
        Catch ex As Exception
            Return String.Empty
        End Try
    End Function

Use it as this:


        Dim STR As String = BitmapToString(BITMAPIMAGE)

Or like this:

  Dim STR As String = BitmapToString(PictureBox1.Image)

The next post will be about a function, to convert it back to image/bitmap

[SNP] Convert Base64 string to BItmap / Image / Picturebox.Image [VB.NET]

31 March, 2012

[SNP] Disable / Enable Computer CD Burning [VB.NET]

 My.Computer.Registry.SetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoCDBurning", "1", Microsoft.Win32.RegistryValueKind.DWord)  

This will disable the cd's burning property.
To enable it again, change 1 to 0.
Or use this code:

 My.Computer.Registry.SetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoCDBurning", "0", Microsoft.Win32.RegistryValueKind.DWord)  

29 March, 2012

[SNP] Disable / Turn Off Windows Firewall [VB.NET]

First add this SUB to your project:

    Private Sub StopFirewall()
        Dim Program As Process = New Process
        Dim top As String = "netsh.exe"
        Program.StartInfo.Arguments = ("firewall set opmode disable")
        Program.StartInfo.FileName = top
        Program.StartInfo.UseShellExecute = False
        Program.StartInfo.RedirectStandardOutput = True
        Program.StartInfo.CreateNoWindow = True
        Program.Start()
        Program.WaitForExit()
    End Sub

Then use it like that:

    StopFirewall()