Peter Kiers
asked on
How to get the creation date of a row of a listview?
Hi,
I have this code that i have put in the code-section.
When a user presses the button the code will be executed
and adds a row to the listview.
In the line that I have marked with an arrow instead of the
string "SubItem1A" I want the date and time of the creation
of the row in the listview.
Who can help me?
Peter
I have this code that i have put in the code-section.
When a user presses the button the code will be executed
and adds a row to the listview.
In the line that I have marked with an arrow instead of the
string "SubItem1A" I want the date and time of the creation
of the row in the listview.
Who can help me?
Peter
private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
{
if (frmNote.ShowDialog() == System.Windows.Forms.DialogResult.Cancel)
{
ListViewItem myItem = new ListViewItem(frmNote.textBox1.Text, 0);
myItem = listView1.Items.Add(myItem);
myItem.SubItems.Add("SubItem1a"); <====================
myItem.SubItems.Add("SubItem1b");
listView1.AutoResizeColumn(0, ColumnHeaderAutoResizeStyle.HeaderSize);
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Found it:
myItem.SubItems.Add(DateTi me.Now.ToS tring());
myItem.SubItems.Add(DateTi
ASKER
500 points are comming to you...
Peter Kiers
Peter Kiers
Sorry, I don't know why I assumed you weren't on .NET.
Also, if you don't like the standard DateTime format you can use
DateTime.Now.Year, DateTime.Now.Month, etc.. and piece them together as strings however you like.
Also, if you don't like the standard DateTime format you can use
DateTime.Now.Year, DateTime.Now.Month, etc.. and piece them together as strings however you like.
ASKER
I get :The name 'now' does not exist in the current context
P.