473,408 Members | 1,973 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

DateTime in DataSet, want to display as Date (11/11/1111) type

I have an array being passed as a parameter to Crystal 9 (using vb .net in VS 2002). The listbox containing the dataset output at runtime shows DateTime format, but I want to only show mm/dd/yyyy format to the user. How is this accomplished? I changed the dataset type for the field to "Date" but it made no difference
Tks.
Nov 20 '05 #1
6 11327
Hi Helen,

There's no really good way to store a date. It is either free text or
date/time. (Not until the next edition of SQL Server will we have a
seperate date data type.)

Until then, you might want to keep the data as it is in the data set. Then,
in the binding's parse and format events, use the Format(myText, "Short
Date") function to format the list box items.

Hope this helps...

Eric

"Helen" <an*******@discussions.microsoft.com> wrote in message
news:79**********************************@microsof t.com...
I have an array being passed as a parameter to Crystal 9 (using vb .net in VS 2002). The listbox containing the dataset output at runtime shows
DateTime format, but I want to only show mm/dd/yyyy format to the user. How
is this accomplished? I changed the dataset type for the field to "Date"
but it made no difference. Tks.

Nov 20 '05 #2
Hi Helen,

Have a look at this.
http://msdn.microsoft.com/library/de...ormattopic.asp

I hope this helps?

Cor
Nov 20 '05 #3
Thanks, Eric and Cor, but I'm still not resolving this. Here's my code
Private Sub ConfigureCrystalReports(
AReport = New A(
Dim myCrystalReportViewer = CrystalReportViewer

Dim myArrayList As ArrayList = New ArrayList(
myArrayList.Add("6/11/2001"
myArrayList.Add("1/31/2001"

ListBox1.DataSource = GetDefaultValuesFromParameterField(AReport
SetCurrentValuesForParameterField(A, myArrayList
myCrystalReportViewer.ReportSource = ARepor

End Su

Private Sub SetCurrentValuesForParameterField(ByVal myReportDocument As ReportDocument, ByVal myArrayList As ArrayList
Dim currentParameterValues As ParameterValues = New ParameterValues(
Dim submittedValue As Objec
For Each submittedValue In myArrayLis
Dim myParameterDiscreteValue As ParameterDiscreteValue = New ParameterDiscreteValue(
myParameterDiscreteValue.Value = submittedValue.ToString(
currentParameterValues.Add(myParameterDiscreteValu e
Nex

Dim myParameterFieldDefinitions As ParameterFieldDefinitions = myReportDocument.DataDefinition.ParameterField
Dim myParameterFieldDefinition As ParameterFieldDefinition = myParameterFieldDefinitions(PARAMETER_FIELD_NAME
myParameterFieldDefinition.ApplyCurrentValues(curr entParameterValues
End Su

Private Function GetDefaultValuesFromParameterField(ByVal myReportDocument As ReportDocument) As ArrayLis
Dim myParameterFieldDefinitions As ParameterFieldDefinitions = myReportDocument.DataDefinition.ParameterField
Dim myParameterFieldDefinition As ParameterFieldDefinition = myParameterFieldDefinitions(PARAMETER_FIELD_NAME
Dim defaultParameterValues As ParameterValues = myParameterFieldDefinition.DefaultValue

Dim myArrayList As ArrayList = New ArrayList(

Dim myParameterValue As ParameterValu
For Each myParameterValue In defaultParameterValue
If (Not myParameterValue.Kind.RangeValue) The
Dim myParameterDiscreteValue As ParameterDiscreteValue = CType(myParameterValue, ParameterDiscreteValue
myArrayList.Add(myParameterDiscreteValue.Value.ToS tring
End I
Nex
Return myArrayLis

End Functio

I'm not finding parse and format events for the bindings, Eric. How would I handle this
Thanks

Nov 20 '05 #4
Hi Helen,

I misreaded your message totally the firsttime,

Does this sample help you?

Cor
\\\
Dim dt As New DataTable("Helen")
dt.Columns.Add(New DataColumn("Dates", _
Type.GetType("System.DateTime")))
For i As Integer = 0 To 10
Dim dr As DataRow = dt.NewRow
dr("Dates") = CDate("01-01-2004").AddMonths(i)
dt.Rows.Add(dr)
Next
MessageBox.Show(CDate(dt.Rows(5)("Dates")).ToStrin g("MM-dd-yyyy"))
////
Nov 20 '05 #5
Hi, Cor:

I see this works, tks for the help. Can I bind a datatable to a listbox, just like a dataset, so then I can build your logic into the listbox?

I've started hardcoding the datasets and it seems more stable. I'd like to try your datatable concept.

Tks, Helen
Nov 20 '05 #6
Hi Helen,

Yes you can.
The listbox and combobox works both a little bit the same and I saw you
managed to do that, the both derive from listcontrol.

I hope this helps?

Cor
I see this works, tks for the help. Can I bind a datatable to a listbox, just like a dataset, so then I can build your logic into the listbox?

Nov 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: John Cosmas | last post by:
I've encountered a table that stores dates in Gregorian format so that the dates and time looks like straight integers that cannot be easily discrened as a date or time by just looking at it. I'm...
1
by: ABC | last post by:
How to convert a date string to datetime value with custom date format? e.g. Date String Date Format Result (DateTime value) "05/07/2004" "MM/dd/yyyy" May 7, 2004 "01062005" ...
2
by: Kiran | last post by:
Hi, Is it possible to display date in different languages depending upon the culture. Thanks Kiran
1
by: Agnes | last post by:
I give up the 'dd-mm-yyyy' bindign question. However, how can i make the text box display date without time ??? Thank
1
by: glenn | last post by:
Hi folks, I am doing an UPDATE to a table that has a field for a DATE data type. I am using MS Access. The UPDATE works fine but when I try to place the DATE field in the mix it blows up. ...
2
sumaiya
by: sumaiya | last post by:
how can i display date subtraction
6
by: dkyadav80 | last post by:
Hi guys, I have a form in html , all description below: first: name of persion (input type box) second: job profile (input type box) third: experience from: list box (Month : Jan, Feb,.....
1
by: JFKJr | last post by:
Hello everyone, this one might be simple but driving me crazy! Your help will be greatly appreciated. Basically, I created a textbox bound to "Date" field in an Access VBA form. But when the...
6
by: gozdeata | last post by:
hey there, i m trying to get only time information of a date type variable. i got a column in type of char, it keeps time info in hh:mm format - 5 characters when i tried to convert it to date...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.