15.9.10

Get Computer Information

Hi Everybody,
I would like to discuss one of the most FAQs regarding how we can see computer details with VB.NET 2010 console application ? If you have any questions, please feel free to contact me y_turkeli@yahoo.com or yenerturkeli@v-basic.net.

1-) We are creating a new console Application Project (ftp_upload)



2-) We are writing this code

Sub Main()
Console.WriteLine("VB.NET 2010 Computer Information")
Console.WriteLine("Computer Name: " & My.Computer.Name)
Console.WriteLine("Computer Time: " & My.Computer.Clock.LocalTime)
Console.WriteLine("Network is available: " & My.Computer.Network.IsAvailable)
Console.ReadLine()

End Sub

3-) Lets start application

14.9.10

FTP Wizard - VB.NET 2010

Hi Everybody,
I would like to discuss one of the most FAQs regarding how we can upload files on FTP web sites with VB.NET 2010 Windows application ? If you have any questions, please feel free to contact me y_turkeli@yahoo.com or yenerturkeli@v-basic.net.

1-) We are creating a new Windows Application Project (ftp_upload)





2-) We are designing this windows form in a similar way to the picture below




3-)We are writing this code

Private Sub select_btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles select_btn.Click
Dim open_file As New OpenFileDialog
open_file.Filter = "Files *.*"

Try
If open_file.ShowDialog() = DialogResult.OK Then

file_name_txt.Text = open_file.FileName
Else
MsgBox("Please select a file", vbInformation, "FTP Wizard")

End If
Catch ex As Exception
MsgBox(ex.Message, vbCritical, "FTP Wizard")
End Try

End Sub



Public ReadOnly Property name_f(ByVal path As String) As String

Get

Dim i As Integer = path.LastIndexOf("\")

If i >= 0 And i < (path.Length - 1)

Then Return path.Substring(i + 1)

Else Return ""

End If

End Get

End Property


Private Sub upload_btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles upload_btn.Click

Try Dim ftp_request As System.Net.FtpWebRequest = _ CType(System.Net.FtpWebRequest.Create("ftp://ftp.v-basic.net/httpdocs/vb_ftp_wizard/" & name_f(file_name_txt.Text)), System.Net.FtpWebRequest)

ftp_request.Method = System.Net.WebRequestMethods.Ftp.UploadFile

ftp_request.Credentials = New System.Net.NetworkCredential("yenerturkeli", "h545454445") ftp_request.UseBinary = True

ftp_request.KeepAlive = False

ftp_request.Proxy = Nothing

Dim ftp_file() As Byte = System.IO.File.ReadAllBytes(file_name_txt.Text)

Dim f_stream As System.IO.Stream = ftp_request.GetRequestStream f_stream.Write(ftp_file, 0, ftp_file.Length)

f_stream.Close()

f_stream.Dispose()

MsgBox("Excellent File Published", vbInformation, "FTP Wizard")

Catch ex As Exception

MsgBox(ex.Message, vbCritical, "FTP Wizard")

End Try

End Sub

4-) Lets start application






5-) Lets check the FTP folder

Have a great day and enjoy with useful essay.
Yener Turkeli

1.9.10

Picture Get Pixel with VB.NET 2010

Hi Everybody,
I would like to discuss one of the most FAQs regarding how we can see image's RGB values with VB.NET 2010 Windows application ? If you have any questions, please feel free to contact me y_turkeli@yahoo.com or yenerturkeli@v-basic.net.

What is RGB?
RGB(Red,Green,Blue) is a color model which provide in various ways to produce colors.

What is Pixel?
Pixel is a single point of image, in other words, the smallest addressable screen element in a image.

1-) We are creating a new Windows Application Project (picture_get_pixels)



2-) We are designing this windows form in a similar way to bellowing picture
(1 Picturebox, 2 textbox , 2 button)



3-) We are writing this code

Private Sub upld_btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles upld_btn.Click
Dim open_file As New OpenFileDialog
open_file.Filter = "Pictures Files| *.bmp;*.jpg;*.gif;*.wmf;*.tif;*.png"

Try
If open_file.ShowDialog() = DialogResult.OK Then

picture_bx.Image = Image.FromFile(open_file.FileName)

Else
MsgBox("Please select a picture", vbInformation, "Pictures Files")

End If
Catch ex As Exception
MsgBox(ex.Message, vbCritical, "Pictures Files")
End Try




End Sub

Private Sub get_btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles get_btn.Click
Try
Dim r_color As Color
Dim picture_b As New Bitmap(picture_bx.Image)

r_color = picture_b.GetPixel(x_txt.Text, y_txt.Text)

MsgBox("Red Value: " & r_color.R & " Green Value: " & r_color.G & " Blue Value " & r_color.B, vbInformation, "Pictures Files")

Catch ex As Exception
MsgBox(ex.Message)
End Try

End Sub

4-) Lets start application