日期:2014-05-20  浏览次数:20645 次

winform 问题 集锦
1.datagrid 怎么控制列表 字段的宽度。
  2.一个日。框怎么显示提前一个月的时间。
  3.怎样将GATAGRID里面的数据导出成EXECL文件。
  4.关闭窗体的时候提示是否关闭
  5.怎样用C#实现备份还原数据库。
  6.3.怎样将GATAGRID里面的数据做成报表。
  7.用户在登录的时候输入完用户名密码后,按回车直接登录,不用切换焦点到登录, 回车的ASSIC码?

------解决方案--------------------
C# code

1.dataGridView1.Columns["colName"].Width
2.dateTimePicker1.Value = DateTime.Today.AddMonths(-1);
3.参照[url=http://blog.csdn.net/bat800/article/details/1694537][/url]
4.
  if (MessageBox.Show("msg", "提示关闭", MessageBoxButtons.YesNo, MessageBoxIcon.None) == DialogResult.Yes)
  this.Close();
5.google,baidu
6.同上
7.在密码框的这个事件里 keyperess 判断回车指定到btnLogin.Focus();

------解决方案--------------------
LZ的问题很多啊,
第4个问题
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
if (exit == "")
{
if (MessageBox.Show(this, "确定要退出吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information) != DialogResult.Yes)
{
e.Cancel = true;
}
}
}
------解决方案--------------------
不好意思,把if(exit==""){}这个去掉。
------解决方案--------------------
做c#以来我没用过datagridview,
用xptable,很好用
------解决方案--------------------
你这是考试啊,还是真有这么多问题啊?
------解决方案--------------------
最后一个在窗体的keyPress或者KeyDown方法中写啦
如果是回车执行登录的操作
------解决方案--------------------
找本实例的书参考参考吧,《C#开发实战1200例》,里面有你要的,所有!