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?
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
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?
Re: trying to determine if a date has changed in a mshflexgrid vb6
Quote:
Originally Posted by
Bobbles
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
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
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.....
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