MrMay
asked on
C# Listview formatting
Hello...
I have a listview in a C# project.
Here is my line of code that shows a current DateTime from an access Database
listView2.Items[x].SubItem s.Add(ds.T ables["Not es"].Rows[ x]["Tim"]. ToString() );"
It works fine... but instead of showing "16-Sept-11 6:05:00 AM" I just want it to show the time... "6:05:00 AM"
Can someone show me what needs to be added to my line of code to change the formatting..
Please and thank you.
I have a listview in a C# project.
Here is my line of code that shows a current DateTime from an access Database
listView2.Items[x].SubItem
It works fine... but instead of showing "16-Sept-11 6:05:00 AM" I just want it to show the time... "6:05:00 AM"
Can someone show me what needs to be added to my line of code to change the formatting..
Please and thank you.
(datetime) (ds.Tables["Notes"].Rows[x ]["Tim"]). ToShortTim eString(); "
Please try:
listView2.Items[x].SubItem s.Add(ds.T ables["Not es"].Rows[ x]["Tim"]. ToString(" t"));
listView2.Items[x].SubItem
ASKER
James Burger.. are you saying I should do this;
listView2.Items[x].SubItem s.Add(date time)(ds.T ables["Not es"].Rows[ x]["Tim"]. ToShortTim eString()) ;
if yes... the compiler does not like it... no such thing as ToshortTimeString();
listView2.Items[x].SubItem
if yes... the compiler does not like it... no such thing as ToshortTimeString();
ASKER
wdosanjos.... I tried that before... its no good... I get an error that reads "No overload for method 'ToString" takes '1' arguments.
Please let me know what is the value of ds.Tables["Notes"].Rows[x] ["Tim"].Ge tType().Na me. It seems that it's not a DateTime.
ASKER
wdosanjos... I just ran that command... and it returns DateTime.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
wdosanjos... Yes... thank you that worked...
Thank you so much... :)
Thank you so much... :)
ASKER
stuck with me... till we got a correct solution.