15.11.10

Perfect Style with VB.NET 2010

Hi Everybody,
I would like to explain one of faq within this essay , how can I change standart button style with paint events (VB.NET 2010 windows application)? If any question, please feel free to contact me y_turkeli@yahoo.com or yenerturkeli@v-basic.net.

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




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




3-)We are writing this code

Private Sub Button1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Button1.Paint
Dim perfect_style As New System.Drawing.Drawing2D.GraphicsPath

perfect_style.AddEllipse(0, 0, 160, 50)
sender.region = New Region(perfect_style)

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MsgBox("Hello Perfect Style", vbInformation, "Perfect Style")
End Sub


4-) Lets start application and click button





Have a great day

Yener Turkeli
yenerturkeli@v-basic.net

14.11.10

Windows API with VB.NET 2010


Hi Everybody,
I would like to explain one of faq within this essay , how can I can shutdown and restrat Windows with VB.NET 2010 console application? If any question, please feel free to contact me y_turkeli@yahoo.com or yenerturkeli@v-basic.net.

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



2-) We are writing this code

Sub Main()

Console.BackgroundColor = ConsoleColor.Blue
Console.Title = "Restart Windows With VB.NET"
Console.ForegroundColor = ConsoleColor.Red

Console.WriteLine("Do you want to restart or shutdown your computer?")
Console.WriteLine("Please press S by keyboard in order to shutdown ")
Console.WriteLine("Please press R by keyboard in order to restart ")

Dim preferrence As String
preferrence = Console.ReadLine()

If preferrence = "S" Then
System.Diagnostics.Process.Start("ShutDown", "/s")
ElseIf preferrence = "R" Then

System.Diagnostics.Process.Start("ShutDown", "/r")

Else

Console.WriteLine("Please press S or R ")

End If

Console.ReadLine()

3-) Lets start application





4-) Press R or S and see the result


1.11.10

RGB Color Combination with VB.NET 2010

Hi Everybody,
I would like to explain one of FAQs within this essay , how can we see RGB color details with VB.NET 2010 windows application? If any question, please feel free to contact me y_turkeli@yahoo.com or yenerturkeli@v-basic.net.

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



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



3-)We are writing this code

Private Sub apply_btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles apply_btn.Click
'set rgb color
Try
'show rgb color combination on picturebox
PictureBox1.BackColor = Color.FromArgb(Val(red_txt.Text), Val(green_txt.Text), Val(blue_txt.Text))
Catch ex As Exception

'give message any exception
MsgBox(ex.Message)
End Try


End Sub


4-) Lets start application and click apply button




5-) Change RGB text values and click button again




Have a great day

Yener Turkeli
yenerturkeli@v-basic.net