Visual Basic
--------------------------
Kod;
Option Explicit
Private Sub cmdHesapla_Click()
Dim Gun As Integer
Dim Tarih As Date
If txtYil.Text = "" Or txtYil.Text < 1800 Then _
txtYil.Text = "": txtYil.SetFocus: Exit Sub
If txtHafta.Text = "" Or txtHafta.Text > 52 Then _
txtHafta.Text = "": txtHafta.SetFocus: Exit Sub
Tarih = CDate("01/01/" + Str(txtYil.Text))
For Gun = 0 To 365
If DatePart("ww", Tarih + Gun) = txtHafta.Text Then _
MsgBox Str(txtYil.Text) + " yılının " + txtHafta.Text + _
". haftasının ilk günü " + Format(Tarih + Gun, "d mmmm yyyy dddd") _
, vbInformation, "Sonuç": txtHafta.SetFocus: Exit For
Next
End Sub
Private Sub Form_Activate()
txtYil.Text = Year(Date)
txtHafta.text = 1
txtYil.SetFocus
End Sub
Private Sub txtHafta_GotFocus()
txtHafta.SelStart = 0
txtHafta.SelLength = Len(txtHafta.Text)
End Sub
Private Sub txtYil_GotFocus()
txtYil.SelStart = 0
txtYil.SelLength = Len(txtYil.Text)
End Sub
--------------------------
Kod;
Option Explicit
Private Sub cmdHesapla_Click()
Dim Gun As Integer
Dim Tarih As Date
If txtYil.Text = "" Or txtYil.Text < 1800 Then _
txtYil.Text = "": txtYil.SetFocus: Exit Sub
If txtHafta.Text = "" Or txtHafta.Text > 52 Then _
txtHafta.Text = "": txtHafta.SetFocus: Exit Sub
Tarih = CDate("01/01/" + Str(txtYil.Text))
For Gun = 0 To 365
If DatePart("ww", Tarih + Gun) = txtHafta.Text Then _
MsgBox Str(txtYil.Text) + " yılının " + txtHafta.Text + _
". haftasının ilk günü " + Format(Tarih + Gun, "d mmmm yyyy dddd") _
, vbInformation, "Sonuç": txtHafta.SetFocus: Exit For
Next
End Sub
Private Sub Form_Activate()
txtYil.Text = Year(Date)
txtHafta.text = 1
txtYil.SetFocus
End Sub
Private Sub txtHafta_GotFocus()
txtHafta.SelStart = 0
txtHafta.SelLength = Len(txtHafta.Text)
End Sub
Private Sub txtYil_GotFocus()
txtYil.SelStart = 0
txtYil.SelLength = Len(txtYil.Text)
End Sub