Posts tagged DateTimePicker
Kayıt işlemi sonrası alanları sıfırlama
12 years ago
by Varol AKSOY
in Yazılım
Dataları kaydet işleminden sonra onlarca kontrolü sıfırlamak için tek tek textbox.text=”" yazmıyorsunuzdur umarım
Projelerde kullandığım küçük kod parçacağını paylaşayım dedim.
Private Sub EmptyTextBoxValues(ByVal parent As Control)
For Each c As Control In parent.Controls
If (c.Controls.Count > 0) Then
EmptyTextBoxValues(c)
Else
If TypeOf c Is TextBox Then
CType(c, TextBox).Text = “”
ElseIf TypeOf c Is DateTimePicker Then
CType(c, DateTimePicker).Text = Date.Today
ElseIf TypeOf c Is ComboBox Then
CType(c, ComboBox).Text = “”
cbYil.Text = Date.Now.Year
End If
End If
Next
End Sub
Private Sub Bosalt(ByVal parent As Control)
For Each c As Control In parent.Controls
If (c.Controls.Count > 0) Then
Bosalt(c)
Else
If TypeOf c Is TextBox Then
CType(c, TextBox).Text = “”
ElseIf TypeOf c Is DateTimePicker Then
CType(c, DateTimePicker).Text = Date.Today
ElseIf TypeOf c Is ComboBox Then
CType(c, ComboBox).Text = “”
End If
End If
Next
End Sub
Kullandığınız kontrole göre ElseIf TypeOf c Is KontrolAdi Then şeklinde düzenleyebilirsiniz.

Son cıvıldamalar