Hello,
For this, you should not use the GetSQLRawFormattedDate function, but the
DateTime value of the date time picker (DateTimePicker1.Value)
You can just do:
DateTimePicker1.Value.ToString("yyyyMMdd")
Easy enough!
Niels
On Wed, Feb 29, 2012 at 6:22 PM, Eddy Wu <[email protected]> wrote:
> my project contains one DateTimePicker, one Button and a ListBox. each
> time the user click the button then the *date string* value would pass in
> the ListBox Control, I had declared one User Defined Function named
> "GetSQLRawFormattedDate(ByVal SDate As String) As String" to handled the
> reverse order of the character string representation of the *Date String*from
> right to left so it would looks like "20120301", I think this
> formatted *datestring* can then be pass to the MySql table structure, but
> unfortunately it ran to did not any changes to the result as I expected
> before.
>
> please examine the code snippet I had done so far :
> ............................................
> ............................................
> ............................................
>
> // The Trigger Section
> Private Sub BtnParser_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles BtnParser.Click
> Dim strdate As String = DateTimePicker1.Value.ToShortDateString
> Dim sqlformstr As String = GetSQLRawFormattedDate(strdate.Trim)
>
> ListBox1.Items.Add(sqlformstr)
>
> End Sub
>
> Private Function GetSQLRawFormattedDate(ByVal SDate As String) As String
> Dim tempStr As String = SDate
> Dim retStr As String = Nothing
>
> For n As Integer = tempStr.Length - 1 To 0
> If (tempStr.Chars(n) <> "/"c) Or (tempStr.Chars(n) <> "-"c)
> Then
> retStr &= String.Concat("", tempStr(n))
> End If
> Next
>
> Return tempStr.Trim
> End Function
>
> but still didn't show any positive changes, please help ...
>
> --
> You received this message because you are subscribed to the Google
> Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML
> Web Services,.NET Remoting" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en
> or visit the group website at http://megasolutions.net
>
--
You received this message because you are subscribed to the Google
Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML
Web Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en
or visit the group website at http://megasolutions.net