返回首页

喜的朋友,
我有一个日期和一个int。我想从一个给定的日期减去整数。

[编辑>复制注释]

DateTime dt = new DateTime();

            dt = Calendar.SelectedDate;

            dt = dt.AddDays(Convert.ToInt32(txtadd.Text));

           lblgetdate.Text = dt.ToLongDateString();

            DateTime sDate = new DateTime();

            sDate = Calendar.SelectedDate;

            DateTime eDate = new DateTime();

            eDate = Convert.ToDateTime(lblgetdate.Text);

            DayOfWeek fWeek = DayOfWeek.Friday;

 

         

            int totCount = CountDayOcurrence(sDate, eDate, fWeek);

            lblweekday.Text = totCount.ToString();   

我要减去从lblweekday lblgetdate的。| shrivastava.mayank

回答

评论会员:。坦维尔答 时间:2012/02/07
试试这个

Dim dt As New Date

dt = "26-12-2011"

Dim a As Integer = 6

Dim a1 As Integer = 1

 

 While a1 <= Len(dt)

   If a = Mid(dt, a1, 1) Then

      MsgBox(a)

      Exit While

   End If

   a1 = a1 + 1

 End While

 

评论会员:KARTHIKHarve 时间:2012/02/07
你好,
我写了简单的Windows窗体应用程序,
它由一个包含两列的表格,DataGridView1控制
当你进入细胞中的第一列的日期,然后按输入
在同一行seckond的列的单元格的值变为
星期根据输入的日期,
和焦点移到下一行的第一列细胞。
我已经使用了:
DataGridViewCellEndEdit
编辑模式为当前单元格结束时发生的事件
afther你按回车,单击DataGridView控件或其他细胞。

代码为Program.cs的


/*

 * Created by SharpDevelop.

 * User: Peri 沤eljko

 * Date: 27.12.2011

 * Time: 14:50

 * 

 */

using System;

using System.Windows.Forms;

namespace Date_and_days

{

	/// <summary>

	/// Class with program entry point.

	/// </summary>

	internal sealed class Program

	{

		/// <summary>

		/// Program entry point.

		/// </summary>

		[STAThread]

		private static void Main(string[] args)

		{

			Application.EnableVisualStyles();

			Application.SetCompatibleTextRenderingDefault(false);

			Application.Run(new MainForm());

		}

		

	}

}


代码为MainForm.cs:

{体C3}
代码为MainForm.Designer.cs

{的C4}
所有最好的,
perić泽利科