Re: How to get slashes instead of dashes in mshFlexGrid

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Rick Rothstein (rickNOSPAMnews_at_NOSPAMcomcast.net)
Date: 05/12/04


Date: Wed, 12 May 2004 10:12:57 -0400

How were your dates placed into the grid initially? I don't use the
MSHFlexGrid control myself, but it is my understanding that it holds
Strings (and Pictures) and not Dates (as in VB type dates). I'm going to
guess that your dates were placed using the Date$ function initially.
There are two "what is the current date" functions in VB (ignoring Now
which returns the time too)... Date and Date$. Date will use the
delimiter set in the Regional settings, but Date$ will always use a dash
as its delimiter. Of course I'm only guessing, but It sounds to me like
that is where the problem might be.

Rick - MVP

"George" <x@toto.com> wrote in message
news:40a202b4$0$27679$636a15ce@news.free.fr...
>
> "Jan Hyde" <StellaDrinker@REMOVE.ME.uboot.com> wrote in message
> news:mms3a05r3pnsbdgdlc6n32g0chfom9q33j@4ax.com...
> > "George" <x@toto.com>'s wild thoughts were released on Wed,
> > 12 May 2004 11:11:41 +0200 bearing the following fruit:
> >
> > >Hi,
> > >
> > >I have a mshFlexGrid in which there is a column with dates. The
problem
> is
> > >that they are displayed :
> > >12-05-2004 instead of 12/05/2004.
> > >
> > >I would like to know if it's possible to get the good format
without
> having
> > >to code something like :
> > >
> > >For i = 1 To MSHFlexGrid1.Rows - 1
> > > MSHFlexGrid1.TextMatrix(i, 1) =
Format(MSHFlexGrid1.TextMatrix(i,
> > >1), "dd/mm/yyyy")
> > >Next
> > >
> > >And why the MSHFlexGrid displays the dates with dashes whereas they
are
> with
> > >slashes in my Data Base ?
> >
> > They are not held with slashes in your database.
> >
> > Whatever you used to view the data in your database displays
> > them as dashes, just as the method used to get the data in
> > your VB program has chosed dashes. Probably based on you PC
> > date setting.
> >
> > I assume this a databound grid. Something I never, one
> > reason is that you have less control over the format of the
> > data. I always build up the rows myself and apply whatever
> > formating I require.
> >
> >
> >
> >
> >
> > --
> > Jan Hyde (MVP - Visual Basic)
> >
> > Safety experts say school bus passengers should be belted.
> >
> > (Gunjan Saraf)
> >
> > [Abolish the TV Licence - http://www.tvlicensing.biz/]
> >
>
>
> My date separators in "National Settings" are "/" . So I don't
understand
> why at the first load of my grid the numbers in the date column
> are separated by "-" and if I use the API :
> CDate(MSHFlexGrid1.TextMatrix(i,1)
> and display again the column,the numbers are separated by "/".
>
> I conclude that the problem doesn't come from the settings of my
computer
> but maybe from the way I use MshFlexGrid?!
> My code:
>
> Dim cn As New ADODB.Connection
> Dim rs As New ADODB.Recordset
> Dim strTemp As String
>
> ' txtConn is a TextBox in my form
> strTemp = txtConn
> cn.Open strTemp
>
> ' txtSQL is a TextBox too
> strTemp = txtSQL
> rs.Open strTemp, cn,adOpenStatic, adLockOptimistic
> rs.MoveLast
>
> Set MSHFlexGrid1.Recordset = rs
>
> ' Free resources
> rs.Close
> Set rs = Nothing
> cn.Close
> Set cn = Nothing
>
> Something wrong?
>
> Thanks for your help!
>
>



Relevant Pages

  • Re: Form_KeyDown not trapping arrow keys
    ... > When MSHFlexGrid control has focus, the up and down arrow keys are not ... set add the "invisible" row to the grid initially). ... Private Sub Form_Load ...
    (microsoft.public.vb.controls)
  • Re: Need help to save strings from a file to a structure
    ... I have to take some strings from a file and put them in a record... ... char *protocol; ... `grid` can contain a pointer-to-table value, ... `grid.protocol` is a character pointer that doesn't point anywhere; ...
    (comp.lang.c)
  • Re: Error While Setting the MSHFlexGrid DataSource Property
    ... > While refreshing a MSHFlexGrid control with the following statements ... especially when the PREVIOUS recordset was very large (2000 ... > grid is on a form I've just added to the project, ... necessary to set the data source to Nothing before reassigning it? ...
    (microsoft.public.vb.syntax)
  • Re: in-place string reversal
    ... For short strings (i.e. where large means you don't have enough RAM to ... strTemp = chr + strTemp ... Don't worry about that first malloc, if Python ...
    (comp.lang.python)
  • Re: in-place string reversal
    ... there are a lot of operations around higher level data structures and ... strTemp = chr + strTemp ... if my assumption that strings are immutable and an in-place ... you can create a character array from the array ...
    (comp.lang.python)