Tam Çalışan Yaş Hesaplama Kodu

RujAjan

Özel Üye
Katılım
28 Eki 2012
Mesajlar
2,486
Tepkime puanı
1
Puanları
0
VB 6'da Yazılmstır.Bu Arada Beyler ben VB STUDİO 2010 Kullnıyorum Yardım Gerekırse Hertürlü Yaparım

KODLAR
Public Class Form1
Dim yıl, ay, gun As Integer
Dim dogum_ayı_gun_sayısı_28 As Boolean = False
Dim dogum_ayı_gun_sayısı_29 As Boolean = False
Dim dogum_ayı_gun_sayısı_30 As Boolean = False
Dim dogum_ayı_gun_sayısı_31 As Boolean = False
Dim kontrol As Integer

Private Sub dogum_ayı_kac_gun()
**** bu işemde dogum tarihimizde belirtigimiz ayın kac gun oldugunu buluyoruz

dogum_ayı_gun_sayısı_28 = False
dogum_ayı_gun_sayısı_29 = False
dogum_ayı_gun_sayısı_30 = False
dogum_ayı_gun_sayısı_31 = False
Dim ays As Byte = DateTimePicker1.Value.Month
Dim yılls As Integer = DateTimePicker1.Value.Year
If ays = 1 Or ays = 3 Or ays = 5 Or ays = 7 Or ays = 8 Or ays = 10 Or ays = 12 Then
**** 1-3-5-7-8-10-12.nci aylar her yıl 31 gun ceker
dogum_ayı_gun_sayısı_31 = True
ElseIf ays = 4 Or ays = 6 Or ays = 9 Or ays = 11 Then
**** 4-6-9-11.inci aylar her yıl 30 gun ceker
dogum_ayı_gun_sayısı_30 = True
ElseIf ays = 2 Then
For yıl_say As Integer = 1600 To 5000 Step 4
**** 2.nci ay 28 gun her 4 senede bir kez 29 gun ceker ise
If yıl_say = yılls Then
'ay 29 gun"
dogum_ayı_gun_sayısı_29 = True
dogum_ayı_gun_sayısı_28 = False
Exit For
Else
dogum_ayı_gun_sayısı_29 = False
dogum_ayı_gun_sayısı_28 = True
'ay 28 gun"
End If
Next
Else
End If
**** tanımladıgım 4 tane dogum_ayı_gun_sayısı degerlerinden
**** 1 tanesini True yapıyorum

End Sub

Private Sub dogum_yılı_kontrol()

**** bu işlemde dogum ayına bakarak yıl içerisinde dogulan ay
**** gecilmişmi geçilmemişmi bakıyoruz

If DateTimePicker1.Value.Month < DateTimePicker2.Value.Month Then
**** yıl içerisinde dogum ayının sonrasındaysak zaten yeni yas alınmıstır.
yıl = DateDiff(DateInterval.Year, DateTimePicker1.Value, DateTimePicker2.Value)
ElseIf DateTimePicker1.Value.Month > DateTimePicker2.Value.Month Then
**** yıl içerisinde dogum ayının oncesindeysek yeni yas daha alınmamıstır
yıl = DateDiff(DateInterval.Year, DateTimePicker1.Value, DateTimePicker2.Value) - 1
ElseIf DateTimePicker1.Value.Month = DateTimePicker2.Value.Month Then
**** yıl içerisinde dogum ayının içerisindeysek gunlere bakıyoruz
If DateTimePicker1.Value.Day < DateTimePicker2.Value.Day Then
**** ay içerisinde dogum gunun sonrasındaysak yeni yas alınmıstır
yıl = DateDiff(DateInterval.Year, DateTimePicker1.Value, DateTimePicker2.Value)
ElseIf DateTimePicker1.Value.Day > DateTimePicker2.Value.Day Then
**** ay içerisinde dogum gunun oncesindeysek yeni yas daha alınmamıstır
yıl = DateDiff(DateInterval.Year, DateTimePicker1.Value, DateTimePicker2.Value) - 1
ElseIf DateTimePicker1.Value.Day = DateTimePicker2.Value.Day Then
**** ay içerisinde dogum gunun içindeysek bugun dogum gununuzdur :))
yıl = DateDiff(DateInterval.Year, DateTimePicker1.Value, DateTimePicker2.Value)
End If
End If

End Sub

Private Sub dogum_ayı_kontrol()
**** bu işlemde yıl içerisinde dogum ayımızı kac ay gectigimizi buluyoruz

If DateTimePicker1.Value.Month < DateTimePicker2.Value.Month Then
ay = DateDiff(DateInterval.Month, DateTimePicker1.Value, DateTimePicker2.Value) - (yıl * 12)
ElseIf DateTimePicker1.Value.Month > DateTimePicker2.Value.Month Then
ay = (12 - DateTimePicker1.Value.Month) + DateTimePicker2.Value.Month
ElseIf DateTimePicker1.Value.Month = DateTimePicker2.Value.Month Then
If DateTimePicker1.Value.Day < DateTimePicker2.Value.Day Then
ay = 0
ElseIf DateTimePicker1.Value.Day > DateTimePicker2.Value.Day Then
ay = 11
ElseIf DateTimePicker1.Value.Day = DateTimePicker2.Value.Day Then
ay = 0
End If
End If
End Sub

Private Sub dogum_gunu_kontrol()
**** bu işlemde dogum ayındaki gun sayısına bakılarak kac gunluk oldugumuzu buluyoruz

If DateTimePicker1.Value.Day < DateTimePicker2.Value.Day Then
gun = DateTimePicker2.Value.Day - DateTimePicker1.Value.Day
ElseIf DateTimePicker1.Value.Day > DateTimePicker2.Value.Day Then
If dogum_ayı_gun_sayısı_28 = True Then
gun = (28 - DateTimePicker1.Value.Day) + DateTimePicker2.Value.Day
ElseIf dogum_ayı_gun_sayısı_29 = True Then
gun = (29 - DateTimePicker1.Value.Day) + DateTimePicker2.Value.Day
ElseIf dogum_ayı_gun_sayısı_30 = True Then
gun = (30 - DateTimePicker1.Value.Day) + DateTimePicker2.Value.Day
ElseIf dogum_ayı_gun_sayısı_31 = True Then
gun = (31 - DateTimePicker1.Value.Day) + DateTimePicker2.Value.Day
End If
ElseIf DateTimePicker1.Value.Day = DateTimePicker2.Value.Day Then
gun = 0
End If
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
labell_temizle()
yıl = 0
ay = 0
gun = 0
kontrol = DateDiff(DateInterval.Day, DateTimePicker1.Value, DateTimePicker2.Value)
If kontrol <= 0 Then
Label1.Text = "sacmalama"
Else
dogum_ayı_kac_gun()
dogum_yılı_kontrol()
dogum_ayı_kontrol()
dogum_gunu_kontrol()
Label1.Text = yıl.ToString + " yıl"
Label2.Text = ay.ToString + " ay"
Label3.Text = gun.ToString + " gun"
End If
End Sub

Private Sub labell_temizle()
Label1.Text = ""
Label2.Text = ""
Label3.Text = ""
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
labell_temizle()
End Sub
End Class
 

mersin escort bodrum escort alanya escort kayseri escort konya escort marmaris escort bodrum escort tto dermodicos vozol puff sakarya escort sakarya escort bayan serdivan escort adapazarı escort
Üst
Copyright® Ajanlar.org 2012