tags:

views:

59

answers:

1

Using VB.NET

Using DatagridView, In a Datagrid View values are displaying like this

ID Date

001 23/02/2009
001 24/02/2009
001 25/02/2009

I want to display a date in a textbox after 25/02/2009

I Used a sql query for getting a next date

Select CONVERT(CHAR(10), DATEADD(dd, 1, MAX(SDate)), 103) AS SDate from tb_Sched_Add

the above query is displaying a next date 26/02/2009 in the textbox, but it is taking a some second to display. There is any way in program itself getting a last value of the row (date) in datagridview and display the next date.

Need vb.net code help

+3  A: 

If you have a date in your VB.NET code you can use the DateTime.AddDays method:

Dim latestDate As DateTime = SomeMethodThatGetsLastDate()
Dim nextDate As DateTime = latestDate.AddDays(1)

Perhaps you have populated a list with the existing items, so that you can obtain the latest date from that data?

Fredrik Mörk