|
-
Oct 8th, 2008, 12:46 AM
#1
Thread Starter
Lively Member
-
Oct 8th, 2008, 01:26 AM
#2
Re: [2008] How to add animated alert to a datetime ?!
You should look at the ErrorProvider class. You can add one to your form and then associate it with one or more controls. It can display an Icon of your choosing, which you can set at design time or in code, and it can be set to blink or not. You can just handle the ValueChanged event of your DateTimePicker and then set the ErrorProvider properties accordingly.
-
Oct 8th, 2008, 02:15 AM
#3
Re: [2008] How to add animated alert to a datetime ?!
Animated images cannot be used with ErrorProvider but may be you use animated icons.
-
Oct 8th, 2008, 02:41 AM
#4
Re: [2008] How to add animated alert to a datetime ?!
 Originally Posted by Deepak Sakpal
Animated images cannot be used with ErrorProvider but may be you use animated icons.
From the first post it looks like the only "animation" that's required is blinking, which the ErrorProvider specifically does support.
-
Oct 8th, 2008, 01:34 PM
#5
Thread Starter
Lively Member
Re: [2008] How to add animated alert to a datetime ?!
 Originally Posted by jmcilhinney
You should look at the ErrorProvider class. You can add one to your form and then associate it with one or more controls. It can display an Icon of your choosing, which you can set at design time or in code, and it can be set to blink or not. You can just handle the ValueChanged event of your DateTimePicker and then set the ErrorProvider properties accordingly.
Hi jmcilhinney...
Can please provide me the vb.net codes calculation of three situations alert using the ErrorProvider class because my programming knowledge level in vb.net is very low…
Regards...
-
Oct 8th, 2008, 02:32 PM
#6
Re: [2008] How to add animated alert to a datetime ?!
Just change the icon and blinkstyle of the error provider for each of the three possible situations.
-
Oct 8th, 2008, 05:35 PM
#7
Re: [2008] How to add animated alert to a datetime ?!
 Originally Posted by HOTFIX
Hi jmcilhinney...
Can please provide me the vb.net codes calculation of three situations alert using the ErrorProvider class because my programming knowledge level in vb.net is very low…
Regards... 
Here's your chance to improve it. Have you read the documentation for the ErrorProvider class? Have you created a test project and experimented with it to see what effect each member has? THAT is how you learn. How do you suppose I know how to use an ErrorProvider?
-
Oct 9th, 2008, 03:25 PM
#8
Thread Starter
Lively Member
Re: [2008] How to add animated alert to a datetime ?!
UP
-
Oct 12th, 2008, 01:13 PM
#9
Thread Starter
Lively Member
Re: [2008] How to add animated alert to a datetime ?!
Hi…
I found the codes for datetime alert…
Code:
Public Class Form1
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
My.Settings.Save()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.DateTimePicker1.DataBindings.Add(New System.Windows.Forms.Binding("Value", _
Global.DateTimeAlert.My.MySettings.Default, "Date1", _
True, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged))
ShowErrorIcon()
End Sub
Private Sub ShowErrorIcon()
Try
Me.ErrorProvider1.SetIconPadding(Me.DateTimePicker1, 5)
Select Case DateDiff(DateInterval.Day, Now, Me.DateTimePicker1.Value)
Case Is > 2
Me.ErrorProvider1.Icon = My.Resources.OK
Me.ErrorProvider1.SetError(Me.DateTimePicker1, "more than two days")
Me.ErrorProvider1.BlinkStyle = ErrorBlinkStyle.NeverBlink
Case Is < 1
Me.ErrorProvider1.Icon = My.Resources.Urgent
Me.ErrorProvider1.SetError(Me.DateTimePicker1, "less than one day")
Me.ErrorProvider1.BlinkStyle = ErrorBlinkStyle.AlwaysBlink
Me.ErrorProvider1.BlinkRate = 100
Case Else
Me.ErrorProvider1.Icon = My.Resources.Attention
Me.ErrorProvider1.SetError(Me.DateTimePicker1, "between one and two days")
Me.ErrorProvider1.BlinkStyle = ErrorBlinkStyle.AlwaysBlink
Me.ErrorProvider1.BlinkRate = 800
End Select
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
ShowErrorIcon()
End Sub
End Class
Unfortunately I couldn’t figure out how to make it work with more than one dateTimePickers (multi DateTimePickers)..
Please Help…
Last edited by HOTFIX; Oct 13th, 2008 at 05:01 AM.
-
Oct 13th, 2008, 12:16 AM
#10
Re: [2008] How to add animated alert to a datetime ?!
Delete the ErrorProvider1 control that you have added in design mode and use the code below. It creates the new instance of error provider control for each date time picker control at run-time. I have modified your code a little bit. See if that suits your requirements.
vb.net Code:
Private Sub Form1_Load( _ ByVal sender As System.Object, _ ByVal e As System.EventArgs _ ) Handles MyBase.Load Me.DateTimePicker1.DataBindings.Add(New System.Windows.Forms.Binding("Value", _ Global.DateTimeAlert.My.MySettings.Default, "Date1", _ True, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)) ShowErrorIcon(DateTimePicker1) ShowErrorIcon(DateTimePicker2) ShowErrorIcon(DateTimePicker3) End Sub Private Sub ShowErrorIcon(ByVal dtPicker As DateTimePicker) Dim errProvider As ErrorProvider Try errProvider = New ErrorProvider errProvider.SetIconPadding(dtPicker, 5) Select Case DateDiff(DateInterval.Day, Now, dtPicker.Value) Case Is > 2 errProvider.Icon = My.Resources.OK errProvider.SetError(dtPicker, "more than two days") errProvider.BlinkStyle = ErrorBlinkStyle.NeverBlink Case Is < 1 errProvider.Icon = My.Resources.Urgent errProvider.SetError(dtPicker, "less than one day") errProvider.BlinkStyle = ErrorBlinkStyle.AlwaysBlink errProvider.BlinkRate = 100 Case Else errProvider.Icon = My.Resources.Attention errProvider.SetError(dtPicker, "between one and two days") errProvider.BlinkStyle = ErrorBlinkStyle.AlwaysBlink errProvider.BlinkRate = 800 End Select Catch ex As Exception MessageBox.Show(ex.Message) End Try End Sub
-
Oct 13th, 2008, 04:59 AM
#11
Thread Starter
Lively Member
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
|