Notes![what is notes.io? What is notes.io?](/theme/images/whatisnotesio.png)
![]() ![]() Notes - notes.io |
Form1 Kodları
Public Class Form1
'Public dersler(5) As String
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim frm2 = New Form2()
If ListBox2.Items.Count > 6 Then
MessageBox.Show("6 adetten fazla ders seçemezsiniz!", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error)
Return
End If
For index = 0 To frm2.dersler.Count - 1
frm2.dersler(index) = ListBox2.Items(index)
Next
frm2.adSoyad = TextBox1.Text
frm2.tc = MaskedTextBox1.Text
frm2.ShowDialog()
End Sub
Private Sub ListBox1_DoubleClick(sender As Object, e As EventArgs) Handles ListBox1.DoubleClick
ListBox2.Items.Add(ListBox1.SelectedItem)
ListBox1.Items.Remove(ListBox1.SelectedItem)
End Sub
Private Sub ListBox2_DoubleClick(sender As Object, e As EventArgs) Handles ListBox2.DoubleClick
ListBox1.Items.Add(ListBox2.SelectedItem)
ListBox2.Items.Remove(ListBox2.SelectedItem)
End Sub
End Class
Form2 Kodları
Public Class Form2
Public dersler(5) As String
Public adSoyad, tc As String
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Label1.Text = "Merhaba " + tc + " TC numaralı " + adSoyad + ". Seçtiğiniz dersler aşağıda listelenmiştir."
Label2.Text = dersler(0)
Label3.Text = dersler(1)
Label4.Text = dersler(2)
Label5.Text = dersler(3)
Label6.Text = dersler(4)
Label7.Text = dersler(5)
End Sub
End Class
DİKKAT, BU UYGULAMADA KENDİ YÖNTEMİMİ YAPTIM. FARKLI ŞEKİLDE OLUŞTURULABİLİR.
Vize Öncesi Örnek
Form1 Kodları
Public Class Form1
Dim sayac As Integer
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
sayac += 1
Label3.Text = "Durum: " & sayac & "%"
ProgressBar1.Value = sayac
If sayac = 100 Then
Timer1.Stop()
MessageBox.Show("Süreniz Doldu!", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Hand)
Application.Exit()
End If
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If TextBox1.Text = "admin" And TextBox2.Text = "123456" Then
Timer1.Stop()
Me.Hide()
Dim frm2 = New Form2()
frm2.Show()
End If
End Sub
End Class
Form2 Kodları
Public Class Form2
Dim tc, adSoyad, bolum, kullaniciAdi, sifre As String
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
tc = TextBox1.Text
adSoyad = TextBox2.Text
If ComboBox1.SelectedItem = "BOLUM1" Then
bolum = "01"
ElseIf ComboBox1.SelectedItem = "BOLUM2" Then
bolum = "02"
ElseIf ComboBox1.SelectedItem = "BOLUM3" Then
bolum = "03"
ElseIf ComboBox1.SelectedItem = "BOLUM4" Then
bolum = "04"
End If
kullaniciAdi = bolum + tc.Substring(0, 3) + adSoyad.Substring(0, 1) + adSoyad.Substring(adSoyad.Length - 1)
sifre = tc.Substring(tc.Length - 3) + adSoyad.Substring(0, 3)
ListBox1.Items.Add("Kullanıcı Adı: " + kullaniciAdi)
ListBox1.Items.Add("Şifre: " + sifre)
ListBox1.Items.Add("****************")
End Sub
End Class
DİKKAT, BU SORUDA DA KENDİ YÖNTEMİMİ YAPTIM. SUBSTRING YERİNE STRING İŞLEMLERİ YAPMANIZ GEREKEBİLİR.
################ FINAL ################
################ FINAL ################
SQL giriş ilk örnek
Imports System.Data.SqlClient
Public Class Form1
Dim baglanti As New SqlConnection("Data Source=ASUS;Initial Catalog=kayitlar;Integrated Security=True;Pooling=False")
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim komut As New SqlCommand("SELECT * FROM tablo where plaka='" + TextBox1.Text + "'", baglanti)
Dim dr As SqlDataReader
baglanti.Open()
dr = komut.ExecuteReader
If dr.HasRows Then
MessageBox.Show("Aynı kayıt var.")
Else
dr.Close()
Dim ekleKomut As New SqlCommand("insert into tablo (plaka, marka, model, renk) values('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + ComboBox1.Text + "')", baglanti)
ekleKomut.ExecuteNonQuery()
Button2.Visible = False
Button3.Visible = False
MessageBox.Show("Kayıt başarılı.")
End If
baglanti.Close()
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim komut As New SqlCommand("update tablo set plaka='" + TextBox1.Text + "', marka='" + TextBox2.Text + "', model='" + TextBox3.Text + "', renk='" + ComboBox1.Text + "' where plaka='" + TextBox1.Text + "'", baglanti)
baglanti.Open()
komut.ExecuteNonQuery()
MessageBox.Show("Güncelleme başarılı.")
baglanti.Close()
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim komut As New SqlCommand("DELETE FROM tablo where plaka='" + TextBox1.Text + "'", baglanti)
baglanti.Open()
komut.ExecuteNonQuery()
MessageBox.Show("Silme başarılı.")
baglanti.Close()
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
Dim komut As New SqlCommand("SELECT * FROM tablo where plaka='" + TextBox1.Text + "'", baglanti)
Dim dr As SqlDataReader
baglanti.Open()
dr = komut.ExecuteReader
If dr.HasRows Then
Do While dr.Read
TextBox2.Text = dr("marka")
TextBox3.Text = dr("model")
ComboBox1.Text = dr("renk")
Button2.Visible = True
Button3.Visible = True
Loop
Else
MessageBox.Show("Böyle bir kayıt yok!")
End If
baglanti.Close()
End Sub
End Class
DataGridView Örnek
Imports System.Data.SqlClient
Public Class Form1
Dim baglanti As New SqlConnection("Data Source=ASUS;Initial Catalog=kayitlar;Integrated Security=True;Pooling=False")
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim komut As New SqlCommand("SELECT * FROM ogrenciler where tc='" + MaskedTextBox1.Text + "'", baglanti)
Dim dr As SqlDataReader
baglanti.Open()
dr = komut.ExecuteReader
If dr.HasRows Then
MessageBox.Show("Aynı kayıt var.")
Else
dr.Close()
Dim ekleKomut As New SqlCommand("insert into ogrenciler (tc, ogrenciNo, adSoyad, bolum, sube, telefon, adres) values('" + MaskedTextBox1.Text + "','" + MaskedTextBox2.Text + "','" + TextBox1.Text + "','" + ComboBox1.Text + "','" + ComboBox2.Text + "','" + MaskedTextBox3.Text + "','" + TextBox2.Text + "')", baglanti)
ekleKomut.ExecuteNonQuery()
MessageBox.Show("Kayıt başarılı.")
End If
baglanti.Close()
getir()
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
getir()
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
baglanti.Open()
Dim strSQL As String = "SELECT * FROM ogrenciler where tc='" + MaskedTextBox1.Text + "'"
Dim da As New SqlDataAdapter(strSQL, baglanti)
Dim ds As New DataSet
da.Fill(ds, "ogrenciler")
DataGridView1.DataSource = ds.Tables(0)
If DataGridView1.Rows.Count = 0 Then
MessageBox.Show("Kayıt bulunamadı!")
End If
baglanti.Close()
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim komut As New SqlCommand("update ogrenciler set tc='" + MaskedTextBox1.Text + "', ogrenciNo='" + MaskedTextBox2.Text + "', adSoyad='" + TextBox1.Text + "', bolum='" + ComboBox1.Text + "', sube='" + ComboBox2.Text + "', telefon='" + MaskedTextBox3.Text + "', adres='" + TextBox2.Text + "' where tc='" + MaskedTextBox1.Text + "'", baglanti)
baglanti.Open()
komut.ExecuteNonQuery()
MessageBox.Show("Güncelleme başarılı.")
baglanti.Close()
End Sub
Private Sub SilToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SilToolStripMenuItem.Click
Dim secilen As String
secilen = DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells(1).Value.ToString()
Dim komut As New SqlCommand("DELETE FROM ogrenciler where tc='" + secilen + "'", baglanti)
baglanti.Open()
komut.ExecuteNonQuery()
MessageBox.Show("Silme başarılı.")
baglanti.Close()
getir()
End Sub
Private Sub TextBox3_TextChanged(sender As Object, e As EventArgs) Handles TextBox3.TextChanged
baglanti.Open()
Dim strSQL As String = "SELECT * FROM ogrenciler where tc LIKE '" + TextBox3.Text + "%'"
Dim da As New SqlDataAdapter(strSQL, baglanti)
Dim ds As New DataSet
da.Fill(ds, "ogrenciler")
DataGridView1.DataSource = ds.Tables(0)
baglanti.Close()
End Sub
Private Sub getir()
baglanti.Open()
Dim strSQL As String = "SELECT * FROM ogrenciler"
Dim da As New SqlDataAdapter(strSQL, baglanti)
Dim ds As New DataSet
da.Fill(ds, "ogrenciler")
DataGridView1.DataSource = ds.Tables(0)
baglanti.Close()
End Sub
End Class
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team