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. dates in vb.net...

dates in vb.net...

Scheduled Pinned Locked Moved Visual Basic
csharphelp
5 Posts 2 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.
  • M Offline
    M Offline
    Member 3879881
    wrote on last edited by
    #1

    Hi if i select month and year based on that..., i need that month all dates in my datagrid..., Plz help me...,

    Magi

    B 1 Reply Last reply
    0
    • M Member 3879881

      Hi if i select month and year based on that..., i need that month all dates in my datagrid..., Plz help me...,

      Magi

      B Offline
      B Offline
      bMILAN Cybage
      wrote on last edited by
      #2

      if you want dates of a month in a column just for first date of month as dim date as new date(yyyy,mm,dd) i.e. dim ldtFirst as new date(2007,04,01) - for april and loop through the ldtFirst.DaysInMonth - gives total number of days in the current month, add the rows in the datagrid Milan:rose:

      M 1 Reply Last reply
      0
      • B bMILAN Cybage

        if you want dates of a month in a column just for first date of month as dim date as new date(yyyy,mm,dd) i.e. dim ldtFirst as new date(2007,04,01) - for april and loop through the ldtFirst.DaysInMonth - gives total number of days in the current month, add the rows in the datagrid Milan:rose:

        M Offline
        M Offline
        Member 3879881
        wrote on last edited by
        #3

        plz tell me in loop what condition we want to give..., I am new in this.., Plz send some sample code..., then it will be usefull for me....,

        Magi

        B 1 Reply Last reply
        0
        • M Member 3879881

          plz tell me in loop what condition we want to give..., I am new in this.., Plz send some sample code..., then it will be usefull for me....,

          Magi

          B Offline
          B Offline
          bMILAN Cybage
          wrote on last edited by
          #4

          in this way........... Private Sub LoadDates() Dim dt As New DataTable Dim dr As DataRow Dim lIntIndex As Integer Dim lIntDysInMonth As Integer Dim curDate As New Date(2007, 4, 1) lIntDysInMonth = Date.DaysInMonth(2007, 4) dt.Columns.Add("dates") For lIntIndex = 1 To lIntDysInMonth dr = dt.NewRow dr.Item(0) = curDate.ToShortDateString curDate = curDate.AddDays(1) dt.Rows.Add(dr) Next DataGrid1.DataSource = dt End Sub Milan :)

          M 1 Reply Last reply
          0
          • B bMILAN Cybage

            in this way........... Private Sub LoadDates() Dim dt As New DataTable Dim dr As DataRow Dim lIntIndex As Integer Dim lIntDysInMonth As Integer Dim curDate As New Date(2007, 4, 1) lIntDysInMonth = Date.DaysInMonth(2007, 4) dt.Columns.Add("dates") For lIntIndex = 1 To lIntDysInMonth dr = dt.NewRow dr.Item(0) = curDate.ToShortDateString curDate = curDate.AddDays(1) dt.Rows.Add(dr) Next DataGrid1.DataSource = dt End Sub Milan :)

            M Offline
            M Offline
            Member 3879881
            wrote on last edited by
            #5

            thank u friend.....,

            Magi

            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