
25/06/2010, 15:10
|
 | | | Fecha de Ingreso: junio-2010 Ubicación: Perú - Lima - Chorrillos
Mensajes: 116
Antigüedad: 14 años, 8 meses Puntos: 8 | |
Respuesta: Cruces de fechas con datagridview en vb.net hola gakutaru como estas gracias por tomar encuenta mi mensaje estaba tan loca ya de como solucionar este problema y eso que tiene dias esto y eres el primero en reponderme el detalle esque el codigo ya esta listo solo era revisarlo y me eontre que grababa la misma fecha pero bueno .
Bueno aquí tengo la solucion espero le sirva.
Tengo 2 columas
1. fecha incio =celda 1
2. fecha fin=celda 2 Private Function VALIDA() As Boolean
For Each ROW As DataGridViewRow In DATAGRID.Rows
If ROW.Cells(2).Value <= drRow.Cells(1).Value Then
MsgBox ("La Fecha Fin no puede ser menor o igual a la Fecha Incio ")
Return True
End If
For Each SUBROW As DataGridViewRow In DATAGRID.Rows
If SUBROW.Cells(1).Value <> ROW.Cells(1).Value Then
If CDate(ROW.Cells(1).Value).Date <= CDate(SUBROW.Cells(1).Value).Date And CDate(ROW.Cells(2).Value).Date >= CDate(SUBROW.Cells(1).Value).Date Then
MsgBox ("Hay un Cruce ")
Return True
End If
If CDate(ROW.Cells(1).Value).Date <= CDate(SUBROW.Cells(2).Value).Date And CDate(ROW.Cells(2).Value).Date >= CDate(SUBROW.Cells(1).Value).Date Then
MsgBox("Hay un cruce .")
Return True
End If
End If
Next
Next
Return False
End Function |