Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Using Datagrid to indicate range of dates

Using Datagrid to indicate range of dates

Scheduled Pinned Locked Moved Visual Basic
helpdata-structures
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    VB Guru
    wrote on last edited by
    #1

    Hi I am using a datagrid to indicate employes that are on leave iver a certain period. The code works well for employees that take leave more then one day. The problem arises when the employee only takes one day leave, the datagrid shows the day of leave and every other day up until the end of the array. Please help For i = 0 To oDS.Tables("Dept_History").Rows.Count - 1 dr = dt.NewRow() dr(0) = oDS.Tables("Dept_History").Rows(i).Item("Name").ToString() iCol = 1 For m = Month(NewStartD) To Month(NewEndD) If m = Month(NewEndD) Then lastday = Day(NewEndD) Else lastday = Darray(m) End If If m = Month(NewStartD) Then startday = Day(NewStartD) Else startday = 1 End If For d = startday To lastday Dim CheckDate As Date Dim SD As String Dim ED As String Dim ld As Long Dim FDate As New Date(Year(NewEndD).ToString(), m.ToString(), d.ToString()) 'FDate = m.ToString() & "/" & d.ToString() & "/" & Year(NewEndD).ToString() ED = oDS.Tables("Dept_History").Rows(i).Item("EDate").ToString() SD = oDS.Tables("Dept_History").Rows(i).Item("SDate").ToString() ld = DateDiff(DateInterval.Day, CDate(ED), CDate(SD)) If DateDiff(DateInterval.Day, CDate(FDate), CDate(SD)) = 0 Then dr(iCol) = d.ToString() ElseIf DateDiff(DateInterval.Day, CDate(FDate), CDate(ED)) = 0 Then dr(iCol) = d.ToString() Else dr(iCol) = "0" End If iCol = iCol + 1 Next d Next m dt.Rows.Add(dr) Next i Dim dv As New Dat

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups