Results 1 to 7 of 7

Thread: trying to determine if a date has changed in a mshflexgrid vb6

  1. #1

    Thread Starter
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    trying to determine if a date has changed in a mshflexgrid vb6

    I have mshlexgrid that has a column of dates if the date is clicked it opens another form with a calendar
    if a new date is selected it replaces the selected date
    how can i wait to see if a new date has been selected. before continuing
    Dim OldDate as string
    Dim NewDate as string
    OldDate= gridMaster.TextMatrix(mintgridMasterCurRow,mintgridMasterCurCol)
    open the calendar
    now see it a date has been selected
    Have code processing wait to see if a new date has been selected
    NewDate= gridMaster.TextMatrix(mintgridMasterCurRow,mintgridMasterCurCol)
    If NewDate <> OldDate then
    mbGridisDirty = true
    Save the grid
    else
    mbGridisDirty = false
    End If
    how can this be done?
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  2. #2
    Frenzied Member
    Join Date
    Dec 2008
    Location
    Melbourne Australia
    Posts
    1,487

    Re: trying to determine if a date has changed in a mshflexgrid vb6

    You can show the Form (that contains the Calendar) vbModal
    That Form can have public variables to pass the old date in, and pass out the new date.
    When the user closes that form, your code in the main form will continue from the next line after the call to the Calendar form
    There is a wee bit of extra logic for passing in and out the date, but you should get the gist.

    Rob

  3. #3
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,624

    Re: trying to determine if a date has changed in a mshflexgrid vb6

    Not quite sure what you mean by 'waiting'. As soon as you select the new date from the calendar and set the grid's cell to that date. I am confused by your code where you are setting olddate and newdate to the same grid cell...I would think you would simply reset the grid cell (located on form 1) with the date value of the calendar when the user selects the date. Should be as simple as that. And, you probably don't need an if statement checking 'dirty'...just save it anyway, even if the date doesn't change....hardly any overhead there at all.

    As far as modal, yes, probably a good idea so that it forces the user to select the date before returning to the main form, but it is not NECESSARY. You may want a non-modal form with the calendar set off to the side to use any time. Also, why use a separate form at all? Can you not simply put your calendar control on the form itself?

  4. #4

    Thread Starter
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Re: trying to determine if a date has changed in a mshflexgrid vb6

    Quote Originally Posted by Bobbles View Post
    You can show the Form (that contains the Calendar) vbModal
    That Form can have public variables to pass the old date in, and pass out the new date.
    When the user closes that form, your code in the main form will continue from the next line after the call to the Calendar form
    There is a wee bit of extra logic for passing in and out the date, but you should get the gist.

    Rob
    frmCalendar.Show vbModal
    thanks i tried showing frmCalendar vbmodal, but got an error saying
    "Form alrady displayed cannot show modally" don't know why it has not been accessed previously
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  5. #5

    Thread Starter
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Re: trying to determine if a date has changed in a mshflexgrid vb6

    the grid also has a hidden column where the date determines the filename eg:
    C:\Program Files (x86)\Microsoft Visual Studio\VB10\Tasks\Personal\Tasks\10-25-2016.rtf
    if a date is changed then the filename needs to also change, but if the user exited the calendar without changing the date
    then the filename will not change
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  6. #6
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,624

    Re: trying to determine if a date has changed in a mshflexgrid vb6

    I think you are getting way ahead of yourself.
    You have a grid on a form, right? And in that grid are some columns, at least one of which includes some dates, right?
    And you want to change the date in one of those cells by the user clicking on the cell and then selecting a new date to enter, right? And then you want to update that cell with the new date, and, update an RTF file with that new date, right?

    First, put a calendar control on your screen and make it invisible. If you don't have room on your screen, add a frame in the middle of the screen/grid and make it invisible. Put a calendar control on that frame.
    Then, when you click on a cell in that column, make that control (or frame) visible.
    The user then selects a new date.
    Take that new date and update your grid's cell with that date (grid1.textmatrix(x,y) = Cstr(calendar.value)
    IF THAT works, then you are part way there....
    Next, you write to your file (update/rewrite/whatever) whatever information you want to.
    But, first, let's see if you can update your grid.....

  7. #7

    Thread Starter
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Re: trying to determine if a date has changed in a mshflexgrid vb6

    got it handled
    thanks did not realize i could do this to overcome the error in trying to show vbmodal
    frmCalendar.Hide
    frmCalendar.Show vbModal
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width