社区
C#
帖子详情
怎么把TextBox1.Text中的内容加上一个月后,得到一个新的时间,放入TextBox2,急,谢谢
kingmd3
2003-07-29 11:16:15
同上
...全文
30
14
打赏
收藏
怎么把TextBox1.Text中的内容加上一个月后,得到一个新的时间,放入TextBox2,急,谢谢
同上
复制链接
扫一扫
分享
举报
写回复
配置赞助广告
14 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
horsewww
2003-07-30
打赏
举报
回复
用DataTime.Parse()比用强制转换好
michaelowenii
2003-07-29
打赏
举报
回复
1。首先,你要将textBox1.text 的格式,规定为:日期格式。
2。然后,TextBox2.Text=((DateTime)TextBox1.Text).AddMonths(1).ToShortDateString();
3。ok
zag
2003-07-29
打赏
举报
回复
不好意思,多了个点和括号,正确的应该是:
TextBox2.Text=(DataTime.Parse(TextBox1.Text)).AddMonths(1).ToShortDateString();
zhehui
2003-07-29
打赏
举报
回复
TextBox2.Text=Convert.ToDateTime(TextBox1.Text).AddMonths(1).ToShortDateString()
zag
2003-07-29
打赏
举报
回复
TextBox2.Text=(DataTime.Parse(TextBox1.Text)).).AddMonths(1).ToShortDateString();
gbl777
2003-07-29
打赏
举报
回复
DataTime.Parse(TextBox1.Text);
还有检查你输入的日期格式是否正确
CSTerry
2003-07-29
打赏
举报
回复
(DateTime)TextBox1.Text转不过去?
TextBox1.Text 是时间格式的嘛?
kingmd3
2003-07-29
打赏
举报
回复
(DateTime)TextBox1.Text转不过去?
oh_love
2003-07-29
打赏
举报
回复
Convert.ToDateTime(TextBox1.Text).AddMonths(1).ToShortDateString()
brightheroes
2003-07-29
打赏
举报
回复
同上。
river168
2003-07-29
打赏
举报
回复
TextBox2.Text=((DateTime)TextBox1.Text).AddMonths(1).ToShortDateString();
childeliu
2003-07-29
打赏
举报
回复
没说清楚
xixigongzhu
2003-07-29
打赏
举报
回复
-->((DataTime)TextBox1.Text)
微软根本没提供这种直接转换的机制,编译都通不过,还别说有结果了。
最好规定TextBox的输入格式,否则第一个文本框的格式跟第二个就有可能不一样了。我想这不是斑竹期望的吧。
spiketang
2003-07-29
打赏
举报
回复
真接用TextBox2.Text=((DataTime))TextBox1.Text).AddMonths(1).ToShortDateString();
相关推荐
c#打印窗体
中
的数据
打印窗体
text
box
中
的数据: //在窗体
中
绘制要打印的数据 private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { //绘制label1
中
的
内容
e.Graphics.DrawString(label1.
Text
, new Font("宋体", 20, FontStyle.Regular), Brushes.Black,270, 400); //绘制
text
Box
1
中
的
内容
e.Graphics.DrawString(
text
Box
1.
Text
, new Font("宋体", 20, FontStyle.Regular), Brushes.Black, 330, 400); //绘制label2
中
的
内容
e.Graphics.DrawString(label2.
Text
, new Font("宋体", 20, FontStyle.Regular), Brushes.Black, 270, 430); //绘制
text
Box
2
中
的
内容
e.Graphics.DrawString(
text
Box
2.
Text
, new Font("宋体", 20, FontStyle.Regular), Brushes.Black, 330, 430); //绘制label3
中
的
内容
e.Graphics.DrawString(label3.
Text
, new Font("宋体", 20, FontStyle.Regular), Brushes.Black, 270, 460); //绘制
text
Box
3
中
的
内容
e.Graphics.DrawString(
text
Box
3.
Text
, new Font("宋体", 20, FontStyle.Regular), Brushes.Black, 330, 460);
C#计算器之窗体应用程序最简单计算器
1、调整
text
box
的顺序,按1、2、3排序,并在
text
box
1和
text
box
2之间插入
新
的
text
box
控件 2、在string类型的变量
中
添加Symbol变量 string snum_1, snum_2, sresut, Symbol; 3、利用Symbol变量接受
text
box
4
中
的
内容
,也就是将要输入的运算符号 snum_1 =
text
Box
1.
Text
; sn...
C#字符串查找标记
1.在
Text
Box
中
查找指定字符串: 在
text
Box
2
中
一个
一个
依次查找
text
Box
2
内容
; private void button1_Click(object sender, EventArgs e) { index =
text
Box
2.
Text
.IndexOf(
text
Box
1.
Text
, index); if (index < 0) {...
C# 用文本框输入的
时间
段查询SQL数据库
文本框
Text
Box
1和
Text
Box
2 内分别输入
时间
用这个
时间
段来查询数据库 以下两种字符串都能用来查询数据库: 方法1: string sqlcom = "select * from 表名 where
时间
between '" +
Text
Box
1.
Text
+ "' and '" +
Text
Box
2.
Text
+ "' "; 方法2: string sqlcom = "select * from 表名 where
时间
>= '" +
Text
Box
1.
Text
+
c#
中
有没有类似javascript
中
的eval函数?
我有五个控件
Text
Box
1;
Text
Box
2;
Text
Box
3;
Text
Box
4;
Text
Box
5; 我想通过循环赋值 for(int i=0;i=4;i++) { ....=i.ToString(); } 实现:
Text
Box
1.
Text
=0;
Text
Box
2.
Text
=1;Tex...
发帖
C#
C#
.NET技术 C#
复制链接
扫一扫
10.9w+
社区成员
64.2w+
社区内容
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
帖子事件
创建了帖子
2003-07-29 11:16
社区公告
让您成为最强悍的C#开发者