Reputation: 11972
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
Upvotes: 0
Views: 5501
Reputation: 186
THis option is nice, tho then if you are to iterate with a button click, you are likely to land into issues of not going more than 2 days in go. So a counter has to be in place to increment the value in AddDays(1) so replace "1" with counter++
Upvotes: 0
Reputation: 158309
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?
Upvotes: 4