-->

Sponsor Alanı

Slider

İlgi Çeken Videolar

Sağlık

Teknoloji

Sinema

Televizyon

Ne Nedir?

En5 Konular

ads

Vb.Net TextBox Yazı Tipi İşlemleri

vb.net

TextBox ile Visual Basic'te yazı işlemlerini öğreneceğiz.

Forma eklemeniz gerekenler;

1 tane textbox
9 tane button
1 tane fontdiyalog
1 tane colordialog

Kodlama:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If TextBox1.SelectionLength > 0 Then
            TextBox1.Cut()
        Else
            MsgBox("Seçili Alan Yok!")

        End If
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        If TextBox1.SelectionLength > 0 Then
            TextBox1.Copy()
        Else
            MsgBox("Alan boş!")
        End If
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        TextBox1.Paste()

    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        TextBox1.Undo()
        TextBox1.Font = New Font(Font, FontStyle.Regular)
        TextBox1.ForeColor=color.Black
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        If FontDialog1.ShowDialog = DialogResult.OK Then
            TextBox1.Font = FontDialog1.Font

        End If
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        If ColorDialog1.ShowDialog = DialogResult.OK Then
            TextBox1.ForeColor = ColorDialog1.Color

        End If
    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        TextBox1.Font = New Font(Font, FontStyle.Bold)

    End Sub

    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
        TextBox1.Font = New Font(Font, FontStyle.Italic)
    End Sub

    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
        TextBox1.Font = New Font(Font, FontStyle.Underline)
    End Sub 

Vb.Net İle RAM Bellek Bilgisi Öğrenme

vb.net
Visual Basic ile bu derste    RAM bellek bilgisini gösteren program yapacağız.

Forma şunları ekleyim;

1 tane TextBox
1 tane Button

Kodlama;

Imports System.Runtime.InteropServices

Public Class Form1
    <DllImport("Kernel32.dll", CharSet:=CharSet.Auto, SetLastError:=True)> Public Shared Function GlobalMemoryStatusEx(ByRef IpBuffer As MEMORYSTATUEX) As <MarshalAs(UnmanagedType.Bool)> Boolean

    End Function
    <StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto)> Public Structure MEMORYSTATUEX
        Public dwLength As UInteger
        Public dwMemoryLoad As UInteger
        Public ullTotalPhys As ULong
        Public ullAvailPhys As ULong
        Public ullTotalPageFile As ULong
        Public ullAvailPageFile As ULong
        Public ullTotalVirtual As ULong
        Public ullAvailVirtual As ULong
        Public ullAvailExtendedVirtual As ULong
    End Structure
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim hafıza As New MEMORYSTATUEX()
        hafıza.dwLength = 64
        Dim b As Boolean = GlobalMemoryStatusEx(hafıza)
        TextBox1.Text = TextBox1.Text + "Kullanılan Bellek Mikterı= " & (hafıza.dwMemoryLoad) & vbCrLf
        TextBox1.Text = TextBox1.Text + "Toplam Bellek Miktarı= " & (hafıza.ullTotalPhys  (1024 * 1024)) & " mb" & vbCrLf
        TextBox1.Text = TextBox1.Text + "Boş Bellek Miktarı= " & (hafıza.ullAvailPhys  (1024 * 1024)) & " mb" & vbCrLf
        TextBox1.Text = TextBox1.Text + "Toplam Page File Miktarı= " & (hafıza.ullTotalPageFile  (1024 * 1024)) & " mb" & vbCrLf
        TextBox1.Text = TextBox1.Text + "Boş Page File= " & (hafıza.ullAvailPageFile  (1024 * 1024)) & " mb" & vbCrLf
        TextBox1.Text = TextBox1.Text + "Toplam Sanal Bellek Miktarı= " & (hafıza.ullTotalVirtual  (1024 * 1024)) & " mb" & vbCrLf
        TextBox1.Text = TextBox1.Text + "Boş Sanal Bellek Miktarı= " & (hafıza.ullAvailVirtual  (1024 * 1024)) & " mb"
    End Sub
End Class

Visual Basic İle İşlemci Yüzdesi Alma

vb.net

Vb.Net Dersleri


Bu bölümde Visual Basic İle işlemci yüzdesini almayı göreceğiz.



Dim prc As New System.Diagnostics.PerformanceCounter("Processor", "% Processor Time", "_Total")


yuzde = prc.NextValue()

Vb.Net Mouse Koordinatları

vb.net
Bu konumuzdaVisual Basic ile mouse işlemleri üzerinde kodlama yapacağız.  Vb.Net'de API kullanarak mouse imlecinin yerini tespit ederek değiştirmeyi işleyeceğiz.




Forma 1 tane timer ekleyin

Private Type POINTAPI
        X As Long
        Y As Long
End Type

Declare Function GetCursorPos Lib "user32.dll" (ByVal lpPoint As POINTAPI) As Long
Declare Function SetCursorPos Lib "user32.dll" (ByVal X As Long, ByVal Y As Long)  As Long

Private Sub Timer1_Tick()
Dim yerler As POINATPI
ykr = GetCursorPos(yerler)
Me.Caption = yerler.X & "," & yerler.Y
End Sub


Mouse Konumlandırma

X = 250
Y = 300
yer = SetCursorPos(X,Y)

Vb.Net Klavye ve Mouse'u Devredışı Bırakmak

vb.net
Vb.Net Dersi Bilgisayarınıza girişleri engellemeye yarayan bir program yapacağız. Klavye ve Mouse devre dışı bırakan programı öğreneceğiz.

Forma eklemeniz gereken araçlar;
1 tane Timer
1 tane Command



kodlama;

Option Explicit 

Private Declare Function BlockInput Lib "user32" (ByVal fBlock _ 
As Long ) As Long 

Const API_FALSE = 0& 
Const API_TRUE = 1& 

Private Sub Command1_Click( ) 
Timer1.Interval = 500 
Timer1.Enabled = True 
Call BlockInput(API_TRUE ) 
End Sub 

Private Sub Timer1_Timer( ) 
Static Cnt As Long 

Cnt = Cnt + 1 
If Cnt > 10 Then 
Cnt = 0 
Timer1.Enabled = False 
Call BlockInput(API_FALSE ) 
Label1.Caption = "" 
Else 
Label1.Caption = "kalan zaman gösteriliyor: " _ 
& Format$(CStr((10 - Cnt ) ) / 2, "0.0" ) 
End If 
End Sub

Vb.Net Çalan Müziği Listelemek

teknoloji
Visual Basic Dersleri Media Player'da çalan müziği listeye ekleyelim.

Forma şunları ekleyin;

1 tane medi player
1 tane openfiledialog
1 tane button
1 tane combobox

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        OpenFileDialog1.ShowDialog()
        AxWindowsMediaPlayer1.URL = OpenFileDialog1.FileName
        ComboBox1.Items.Add(AxWindowsMediaPlayer1.URL)

    End Sub

    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        AxWindowsMediaPlayer1.URL = ComboBox1.Text


    End Sub

Vb.Net - Not Defteri Adı Değiştirmek

vb
Bugün basit bir program olan    not defteri adını değiştirmeyi ve  bilgi girmeyi  göstereceğiz.

Forma şunları ekleyin;

2 tane GroupBox

4 tane TextBox

2 tane Button

Textbox1 ile TextBox2'nin  Properties özellikleri bölümünden textaligin özelliğini center yapın.

Public Class Form1
    
    Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal ipClassName As String, ByVal ipWindowName As String) As Integer
    Private Declare Function FindWindowEx Lib "user32.dll" Alias "FindWindowExA" (ByVal hWndParent As Integer, ByVal hWndChildAfter As Integer, ByVal ipszClass As String, ByVal ipszWindow As String) As Integer
    Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal IParam As String) As Integer

    Private Const WM_SETTEXT As Integer = &HC
    Private hwnd As IntPtr
    Private f As IntPtr


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        hwnd = FindWindow(vbNullString, TextBox1.Text)
        SendMessage(hwnd, WM_SETTEXT, 0, TextBox2.Text)
        TextBox3.Text = TextBox2.Text

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        hwnd = FindWindow(vbNullString, TextBox3.Text)
        f = FindWindowEx(hwnd, 0, "Edit", vbNullString)
        SendMessage(f, WM_SETTEXT, 0, TextBox4.Text)

    End Sub
End Class 

Vb.Net Mayın Tarlası Oyunu Yapımı

vb.net

Visual basic ile Oyun Yapımı - Vb.Net Dersleri

Bu Derste mayın tarlası  oyunu yapımını anlatacağız.  Basit bir oyun olan bu  yazılım yeni programcılar için faydalı bir ders olacaktır. 

Forma eklemeniz gereken araçlarınız;

31 Adet Button ekleyin .  Ben mayınları  6 , 5, 11, 17, 2,4,8, 29 a koydum.

kodlar..

Public Class Form1

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        If Button6.Text = "" Then
            Button5.Text = "*"
            Button11.Text = "*"
            Button17.Text = "*"
            Button2.Text = "*"
            Button4.Text = "*"
            Button8.Text = "*"
            Button29.Text = "*"
            Button6.Text = "*"

            Button1.Visible = False
            Button2.Visible = False
            Button3.Visible = False
            Button4.Visible = False
            Button6.Visible = False
            Button9.Visible = False
            Button10.Visible = False
            Button11.Visible = False
            Button13.Visible = False
            Button14.Visible = False
            Button17.Visible = False
            Button18.Visible = False
            Button19.Visible = False
            Button20.Visible = False
            Button21.Visible = False
            Button22.Visible = False
            Button24.Visible = False
            Button25.Visible = False
            Button26.Visible = False
            Button27.Visible = False
            Button29.Visible = False
            Button30.Visible = False
    End Sub

    Private Sub Button31_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button31.Click
        Button1.Visible = True
        Button2.Visible = True
        Button3.Visible = True
        Button4.Visible = True
        Button5.Visible = True
        Button6.Visible = True
        Button7.Visible = True
        Button8.Visible = True
        Button9.Visible = True
        Button10.Visible = True
        Button11.Visible = True
        Button12.Visible = True
        Button13.Visible = True
        Button14.Visible = True
        Button15.Visible = True
        Button16.Visible = True
        Button17.Visible = True
        Button18.Visible = True
        Button19.Visible = True
        Button20.Visible = True
        Button21.Visible = True
        Button22.Visible = True
        Button23.Visible = True
        Button24.Visible = True
        Button25.Visible = True
        Button26.Visible = True
        Button27.Visible = True
        Button28.Visible = True
        Button29.Visible = True
        Button30.Visible = True
        Button5.Text = ""
        Button11.Text = ""
        Button17.Text = ""
        Button2.Text = ""
        Button4.Text = ""
        Button8.Text = ""
        Button29.Text = ""
        Button6.Text = ""
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Button1.Visible = False
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Button2.Visible = False
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Button3.Visible = False
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Button4.Visible = False
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        Button6.Visible = False
    End Sub

    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
        Button9.Visible = False
    End Sub

    Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
        Button10.Visible = False
    End Sub

    Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
        Button11.Visible = False
    End Sub

    Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click
        Button13.Visible = False
    End Sub

    Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click
        Button14.Visible = False
    End Sub

    Private Sub Button17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button17.Click
        Button17.Visible = False
    End Sub

    Private Sub Button18_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button18.Click
        Button18.Visible = False
    End Sub

    Private Sub Button19_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button19.Click
        Button19.Visible = False
    End Sub

    Private Sub Button20_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button20.Click
        Button20.Visible = False
    End Sub

    Private Sub Button21_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button21.Click
        Button21.Visible = False
    End Sub

    Private Sub Button22_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button22.Click
        Button22.Visible = False
    End Sub

    Private Sub Button24_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button24.Click
        Button24.Visible = False
    End Sub

    Private Sub Button25_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button25.Click
        Button25.Visible = False
    End Sub

    Private Sub Button26_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button26.Click
        Button26.Visible = False
    End Sub

    Private Sub Button27_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button27.Click
        Button27.Visible = False
    End Sub

    Private Sub Button29_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button29.Click
        Button29.Visible = False
    End Sub

    Private Sub Button30_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button30.Click
        Button30.Visible = False
    End Sub
End Class



Vb.Net - Veritabanına Bağlanmak

Visual Basic ile Veri tabanı bağlantısı nasıl kurulur?

Vb.Net ile veri tabanı bağlantısı

Forma eklemeniz gereken araçlar; 

7 Adet Button,
2 Adet TextBox ekleyin

İlk Önce project sekmesinden  Add Reference bölümüne gelin. Sonrasında Açılan pencerede .NET, COM, Browse, Recent bölümünü göreceksiniz. Siz "COM"a tıklayın. Karşınıza gelen ekranda Microsoft ActiveX data Objects 2.7'yi seçiniz.

Hemen sonrasında 20021-2003 mdb uzantılı bir acces oluşturun tümüne kayıt ekleyin. Access'i visual projesinin içine bin ve sonra debug'uniç içine kopyalayın.


vb.net

Kodlar,

Public Class Form1
 
    Dim CON As New ADODB.Connection
    Dim Kayitlar As New ADODB.Recordset
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        CON.CursorLocation = ADODB.CursorLocationEnum.adUseClient
        CON.Open("Provider=Microsoft.Jet.OleDb.4.0;Data Source=kayitlar.mdb")
        Kayitlar.Open("Select * from kayitlar", CON, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockOptimistic)

        TextBox1.Text = Kayitlar.Fields("Tckimlik").Value
        TextBox2.Text = Kayitlar.Fields("Adi").UnderlyingValue
        TextBox3.Text = Kayitlar.Fields("Telefon").UnderlyingValue
        TextBox4.Text = Kayitlar.Fields("Adres").UnderlyingValue
        TextBox5.Text = Kayitlar.Fields("Mail").UnderlyingValue
        TextBox6.Text = Kayitlar.Fields("Gun").UnderlyingValue
        TextBox7.Text = Kayitlar.Fields("Ay").UnderlyingValue
        TextBox8.Text = Kayitlar.Fields("Yil").UnderlyingValue
  

    End Sub

    Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Kayitlar.AddNew()
        Kayitlar.Fields("Tckimlik").Value = TextBox1.Text
        Kayitlar.Fields("Adi").Value = TextBox2.Text
        Kayitlar.Fields("Telefon").Value = TextBox3.Text
        Kayitlar.Fields("Adres").Value = TextBox4.Text
        Kayitlar.Fields("Mail").Value = TextBox5.Text
        Kayitlar.Fields("Gun").Value = TextBox6.Text
        Kayitlar.Fields("Ay").Value = TextBox7.Text
        Kayitlar.Fields("Yil").Value = TextBox8.Text

        Kayitlar.Update()
        MsgBox("Kayit İşlemi Tamamlanmıştır")
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Sonraki.Click
        Kayitlar.MovePrevious()
        If Kayitlar.EOF Or Kayitlar.BOF Then
            Kayitlar.MoveNext()
            TextBox1.Text = Kayitlar.Fields("tckimlik").Value
            TextBox2.Text = Kayitlar.Fields("adi").Value
            TextBox3.Text = Kayitlar.Fields("Telefon").Value
            TextBox4.Text = Kayitlar.Fields("Adres").Value
            TextBox5.Text = Kayitlar.Fields("Mail").Value
            TextBox6.Text = Kayitlar.Fields("Gun").Value
            TextBox7.Text = Kayitlar.Fields("Ay").Value
            TextBox8.Text = Kayitlar.Fields("Yil").Value
           
        Else
            TextBox1.Text = Kayitlar.Fields("Tckimlik").Value
            TextBox2.Text = Kayitlar.Fields("adi").Value
            TextBox3.Text = Kayitlar.Fields("Telefon").Value
            TextBox4.Text = Kayitlar.Fields("Adres").Value
            TextBox5.Text = Kayitlar.Fields("Mail").Value
            TextBox6.Text = Kayitlar.Fields("Gun").Value
            TextBox7.Text = Kayitlar.Fields("Ay").Value
            TextBox8.Text = Kayitlar.Fields("Yil").Value
           
        End If
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Kayitlar.MoveNext()
        If Kayitlar.EOF Or Kayitlar.BOF Then
            Kayitlar.MovePrevious()
            TextBox1.Text = Kayitlar.Fields("tckimlik").Value
            TextBox2.Text = Kayitlar.Fields("adi").Value
            TextBox3.Text = Kayitlar.Fields("Telefon").Value
            TextBox4.Text = Kayitlar.Fields("Adres").Value
            TextBox5.Text = Kayitlar.Fields("Mail").Value
            TextBox6.Text = Kayitlar.Fields("Gun").Value
            TextBox7.Text = Kayitlar.Fields("Ay").Value
            TextBox8.Text = Kayitlar.Fields("Yil").Value
      
        Else
            TextBox1.Text = Kayitlar.Fields("tckimlik").Value
            TextBox2.Text = Kayitlar.Fields("adi").Value
            TextBox3.Text = Kayitlar.Fields("Telefon").Value
            TextBox4.Text = Kayitlar.Fields("Adres").Value
            TextBox5.Text = Kayitlar.Fields("Mail").Value
            TextBox6.Text = Kayitlar.Fields("Gun").Value
            TextBox7.Text = Kayitlar.Fields("Ay").Value
            TextBox8.Text = Kayitlar.Fields("Yil").Value
        
        End If
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        TextBox1.Text = ""
        TextBox2.Text = ""
        TextBox3.Text = ""
        TextBox4.Text = ""
        TextBox5.Text = ""
        TextBox6.Text = ""
        TextBox7.Text = ""
        TextBox8.Text = ""
     
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        Kayitlar.Delete()
        TextBox1.Clear()
        TextBox2.Clear()
        TextBox3.Clear()
        TextBox4.Clear()
        TextBox5.Clear()
        TextBox6.Clear()
        TextBox7.Clear()
        TextBox8.Clear()
        Kayitlar.Update()
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        Kayitlar.Fields("tckimlik").Value = TextBox1.Text
        Kayitlar.Fields("adi").Value = TextBox2.Text
        Kayitlar.Fields("Telefon").Value = TextBox3.Text
        Kayitlar.Fields("Adres").Value = TextBox4.Text
        Kayitlar.Fields("Mail").Value = TextBox5.Text
        Kayitlar.Fields("Gun").Value = TextBox6.Text
        Kayitlar.Fields("Ay").Value = TextBox7.Text
        Kayitlar.Fields("Yil").Value = TextBox8.Text
       
        Kayitlar.Update()
        MsgBox("Kayit İşlemi Tamamlanmıştır")
    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        End
    End Sub
End Class

Kaynak >>  http://www.sanalkurs.net/visual-basic-ile-veritabani-baglantisi-5511.html