hi to all
i have a calendar using UltraMonthViewSingle control and want to be able to drag and drop task name's into a certain day of month
but still cant figure out how to insert on my code
Private
Sub UltraMonthViewSingle1_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles
UltraMonthViewSingle1.DragDrop
Dim dItem As String = e.Data.GetData(GetType(String)).ToString()
If dItem <> "" Then
Insert code goes here ???? any idea ???? imagine i have drop the item on july 5
End If
Thanks.
I'm not sure what exactly you are trying to do here, but you can use the control's GetDayFromPoint method to know what date the user is dragging over, and then you can create an Appointment for that date using the UltraMonthViewSingle.CalendarInfo.Appointments.Add method.
hi
im using the UltraMonthViewSingle1_DragDrop event to catch the item draged but when i try to create the appointment for the item using CalendarInfo.Appointments.Add(.GetDayFromPoint(e.X, e.Y).Date, dItem) it not work like should be, the problem is that i drag the item to july first and the date for that location is july 9 or if i drag and drop the item into july 14 the cppointment is created for july 22, do basically if i drop on any date the code add me 8 days to
this is the code
Private Sub UltraMonthViewSingle1_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles UltraMonthViewSingle1.DragDrop
With Me.UltraMonthViewSingle1
.CalendarInfo.Appointments.Add(.GetDayFromPoint(e.X, e.Y).Date, dItem)
End With
End Sub
Thanks,
You have to convert the e.X, e.Y coordinate pair to client coordinates, using the control's PointToClient method
either
.GetDayFromPoint() or .PointToClient are asking for system drawing point that is not available on dragdrop event, i only have the cordinates "x" and "y"
also tried Dim ClientPoint As New Point(e.X, e.Y) but still same problem where adding 8 days to the date where i drop the item
do you have a sample?
Thanks
ok problem fixed using the following code
Dim
ClientPoint As New Point(e.X, e.Y)
ClientPoint = UltraMonthViewSingle1.PointToClient(ClientPoint)