|
-
Aug 2nd, 2010, 06:03 PM
#1
Thread Starter
New Member
[RESOLVED] database form
Hello, I'm new in this stuff and I already need some help. I try to make a WFA for filling, reading etc. to a database. I want to compare 2 dates (actually 1 date is changed by 42 days) that are chosen by a user through a datetimepicker. After comparing the 2 dates the "newest" date has to show up in a non editable textbox. This Is my code (of course I have 2 subs for the datetimepickers as well).
Code:
Private Sub AwbdatumTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AwbdatumTextBox.TextChanged
Dim DatumbinnenkomstDateTimePicker As DateTime
Dim DatumbeschikkingDateTimePicker As DateTime
Dim beschikking As DateTime
beschikking = DateAdd("d", 42, DatumbeschikkingDateTimePicker)
If DatumbinnenkomstDateTimePicker > beschikking Then
Me.AwbdatumTextBox.Text = DatumbinnenkomstDateTimePicker.ToString("ddMMyyy")
Else
Me.AwbdatumTextBox.Text = beschikking.ToString("ddMMyyy")
End If
End Sub
Thanks in advance
-
Aug 2nd, 2010, 06:10 PM
#2
Re: database form
declare:
vb Code:
Dim DatumbinnenkomstDateTimePicker As DateTime
Dim DatumbeschikkingDateTimePicker As DateTime
at form level, then they'll be available in your dtp_valuechanged event (for setting) + your AwbdatumTextBox_TextChanged event (for comparing).
at least i assume that's what you're asking?
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Aug 3rd, 2010, 02:00 PM
#3
Thread Starter
New Member
Re: database form
Thanks a lot that helped . I had also to change some of my code so now it looks like:
Code:
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim beschikking As Date
beschikking = DateAdd("d", 42, DatumbeschikkingDateTimePicker.Value)
If DatumbinnenkomstDateTimePicker.Value > beschikking Then
Me.AwbdatumTextBox.Text = DatumbinnenkomstDateTimePicker.Value.ToString("dd-MM-yyyy")
Else
Me.AwbdatumTextBox.Text = beschikking.ToString("dd-MM-yyyy")
End If
End Sub
As you can see I added a button, otherwise the textbox doesn't show the date. That's my next step, I want the textbox to show the date without pushing a button.
-
Aug 3rd, 2010, 02:35 PM
#4
Re: [RESOLVED] database form
try this:
vb Code:
Private Sub DatumbinnenkomstDateTimePicker_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DatumbinnenkomstDateTimePicker.ValueChanged
Dim beschikking As Date
beschikking = DateAdd("d", 42, DatumbeschikkingDateTimePicker.Value)
If DatumbinnenkomstDateTimePicker.Value > beschikking Then
Me.AwbdatumTextBox.Text = DatumbinnenkomstDateTimePicker.Value.ToString("dd-MM-yyyy")
Else
Me.AwbdatumTextBox.Text = beschikking.ToString("dd-MM-yyyy")
End If
End Sub
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|