Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have this code in vb 2008
VB
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
       TextBox1.Text = DataGridView1.CurrentCell.Value.ToString
       If Date.Now = TextBox1.Text Then
           DataGridView1.CurrentCell.Style.BackColor = Color.Blue
       End If
   End Sub

The textbox copies time too, I want to copy only the date.

Kyriakos
Posted

1 solution

Hi,
VB
TextBox1.Text = DataGridView1.CurrentCell.Value.ToString("dd-MM-yyyy")

for more formats visit below link...
http://msdn.microsoft.com/en-us/library/zdtaw1bw(v=vs.110).aspx?cs-save-lang=1&cs-lang=vb#code-snippet-2[^]
Happy Coding!
:)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900