Visual Basic Windows Programlama
Konular Değişken Tipleri Hata Yakalama Windows bileşenlerinin kullanılması Menu ve Toolbar oluşturma Yazdırma işlemleri Veri Tabanı işlemleri Grafik işlemleri
Private : Yerel Değişken tanımlamak için kullanılır. Public : Global Değişken tanımlamak için kullanılır. Değişken Tipleri : Byte : 0 ile 255 arasında değer alır. Short : 32.768 ile 32.767 Integer : 2.147.483.648 ile 2.147.483.647 Long : 9.223.372.036.854.775.808 ile 9.223.372.036.854.775.807 Single : ±3.402823x10 38 ile ±1.401298x10 45 Double : ±1.79769313486232x10 308 ile ±4.94065645841247x10 324 Decimal : ±79.228.162.514.264.337.593.543.950.335 bütün basamaklar Boolean : 2 byte lık True False Char : 2 byte lık karakter String : 2 milyar karaktere kadar atama yapar Date : 8 byte dır tarih ve saat içerir Object: pointer veri tipidir. Nesnenin bellekteki adresini gösterir.
Değişken Tanımlama Dim x As Integer Dim x As Integer=5 Dim x As Integer=New Integer()
Hata Yakalama Dim x As Integer Try Catch End Try x= 99a Label1.Text=x Label1.Text= Hatalı değer ataması
Button Button1.BackgroundImage=Ctype(New Bitmap( c:\resim\sekil1.jpg ),System.Drawing.Bitmap) Resim alt ortada td olsun Button1.ImageAlign=ContentAlignment.BottomCenter Düğme düz olsun Button1.FlatStyle=FlatStyle.Flat Enter tuşuna basıldığında ğ d düğme ğ tıklansın Me.AcceptButton=Button1 Metni hizalama Button1.TextAlign=ContentAlignment.BottomCenter
Button1.TextAlign=ContentAlignment.BottomLeft Button1.TextAlign=ContentAlignment.BottomRight Kısayol tuşu oluşturma Button1.Text= &Kayıt Alt+K Private Sub Button1_Click( ) TextBox1.Text= Not bilgisi End Sub Label Label1.Text= Text= Düzeltme notu Label1.Text= &Düzeltme notu Label1.TextAlign=ContentAlignment.BottomCenter LinkLabel1.Text= www.microsoft.com
TextBox1.PasswordChar= * TextBox1.MaxLength=11 TextBox1.AutoSize=True TextBox1.Multiline=True TextBox1.ScrollBars=ScrollBars.Both TextBox1.WordWrap=True TextBox1.Clear() ya da TextBox1.Text= TextBox1.Copy() TextBox1.Cut() TextBox1.Undo() TextBox1.Paste()
ListBox ListBox1.Items.Add( Madde1 ) ListBox1.Items.Add(TextBox1.Text) ListBox1.Items.Insert(1, Madde2 ) If ListBox1.Items.IndexOf( Madde3 )>0 Then MsgBox( Aranılan eleman listede var ) ListBox1.Sorted=True ListBox1.Items.Clear() ListBox1.Items.Remove(0) ListBox1.Items.Count() ListBox1.SelectedIndex=0
Liste içeriğini bir diziye kopyalama : Dim mydizi(10) As String Dim eleman As String ListBox1.Items.CopyTo(mydizi,0) For Each eleman ınmydizi Ifeleman<> Then Console.WriteLine(eleman) Next
ListBox1.MultiColumn=True Birden fazla eleman seçme : ListBox1.SelectionMode=SelectionMode.MultiSimple
ComboBox ComboBox1.Items.Add( Madde1 ) ComboBox1.Items.Add(TextBox1.Text) ComboBox1.Items.Insert(1, Madde2 ) If ComboBox1.Items.IndexOf( Madde3 )>0 Then MsgBox( Aranılan eleman listede var ) ComboBox1.Sorted=True ComboBox1.Items.Clear() ComboBox1.Items.Remove(0) ComboBox1.Items.Count()
CheckedListBox1 CheckedListBox1.Items.Add( Madde1 ) CheckedListBox1.Items.Add(TextBox1.Text) CheckedListBox1.Items.Insert(1, Madde2 ) If CheckedListBox1.Items.IndexOf( Madde3 )>0 Then MsgBox( Aranılan eleman listede var ) CheckedListBox1.Sorted=True CheckedListBox1.Items.Clear() CheckedListBox1.Items.Remove(0) CheckedListBox1.Items.Count() CheckedListBox1.CheckedItems.Count()
RadioButton RadioButton1.Text= Madde1 RadioButton1.TextAlign=ContentAlignment.BottomCenter If RadioButton1.Checked Then MsgBox( işaretli ) PictureBox PictureBox1.SizeMode= PictureBoxSizeMode.StretchImage Dim dy As String= c:\resim\res1.jpg ) PictureBox1.Image=Image.FromFile(dy)
Panel Panel1.Controls.Add(RadioButton1) l di 1) Panel1.Controls.Add(RadioButton2) Panel1.Controls.Add(RadioButton3) Panel1.BorderStyle=BorderStyle.Fixed3D Panel1.BorderStyle=BorderStyle.FixedSingle Panel1.BorderStyle=BorderStyle.None Panel1.BackgroundImage=Image.FromFile( c:\resim\resim.ico )