Private Sub btnGetReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGetReport.Click Try btnClearReport.Enabled = True btnGetReport.Enabled = False dv = New DataView(dtClone) Dim strCurCulture As String = System.Threading.Thread.CurrentThread.CurrentCulture.Name Dim culNew As New System.Globalization.CultureInfo(strCurCulture) culNew.DateTimeFormat.ShortDatePattern = "M/d/yyyy" culNew.DateTimeFormat.DateSeparator = "/" System.Threading.Thread.CurrentThread.CurrentCulture = culNew System.Threading.Thread.CurrentThread.CurrentUICulture = culNew Dim filter As String = "[Transaction Date] >= #" & fnGetClientDate(dtpFromDate.Text) & "# and [Transaction Date] <= #" & fnGetClientDate(dtpToDate.Text) & "#" dv.RowFilter = filter gvIPDClaimReportView.DataSource = dv Catch ex As Exception clsWriteLog.WriteLog("Exception in btnGetReport_Click") clsWriteLog.WriteLog("Exception : " + ex.Message) End Try End Sub End Sub 'To get the client selected date in ddmmyyyy format Public Function fnGetClientDate(ByVal ddate As DateTime) As String Dim dte As DateTime = ddate ''Added as on 10-10-11 to get proper date for filter Dim day As String = IIf(Len(dte.Day.ToString()) = 1, "0" & dte.Day.ToString(), dte.Day.ToString()) Dim month As String = CInt(dte.Month) Dim year As String = dte.Year ' Dim strCardDate As String = _day + "-" + _month + "-" + _year '' Dim strCardDate As String = day + month + year ''Dim strCardDate As String = _day + "/" + _month + "/" + _year Dim strCardDate As String = month + "/" + day + "/" + year Try Catch ex As Exception clsWriteLog.WriteLog("Exception in fnGetClientDate") clsWriteLog.WriteLog("Exception : " + ex.Message) End Try Return strCardDate End Function On load am adding this code Collapse | Copy Code Dim strCurCulture As String = System.Threading.Thread.CurrentThread.CurrentCulture.Name Dim culNew As New System.Globalization.CultureInfo(strCurCulture) culNew.DateTimeFormat.ShortDatePattern = "M/d/yyyy" culNew.DateTimeFormat.DateSeparator = "/" System.Threading.Thread.CurrentThread.CurrentCulture = culNew System.Threading.Thread.CurrentThread.CurrentUICulture = culNew Me.StartPosition = FormStartPosition.CenterScreen 'Loads the by default data fovr IPD Claim Report btnClearReport.Enabled = False btnGetReport.Enabled = True dtClone = objMDBLayer.fnGetIPDTransactionReports("") For i = 0 To dtClone.Rows.Count - 1 Dim strTrDate As String = dtClone.Rows(i)(11).ToString() Dim format As String = "ddMMyyyy" 'format.DateSeparator = "-" If (Not strTrDate.Contains("/")) Then Dim dtTrDate As DateTime = DateTime.ParseExact(strTrDate, format, Nothing) dtClone.Rows(i)(11) = dtTrDate.ToString("MM/dd/yyyy") ' dtClone.Rows(i)(11) = dtTrDate End If Next gvIPDClaimReportView.DataSource = dtClone
DateTime
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)