本月(2003-02)C#版的FAQ

<script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 728x15, 创建于 08-4-23MSDN */ google_ad_slot = "3624277373"; google_ad_width = 728; google_ad_height = 15; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 160x600, 创建于 08-4-23MSDN */ google_ad_slot = "4367022601"; google_ad_width = 160; google_ad_height = 600; //--> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
问:如何简便快速的转换字符数组到字符串?<br>
答:char[] ar;<br>
&nbsp;&nbsp;&nbsp;String s = new String(ar);<br>
<br>
问:我想遍历窗体中的某个控件(如DateTimePicker),怎么办? <br>
答:foreach(Control c in this.Controls)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (c is DateTimePicker)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//你的代码<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// MessageBox.Show( ((DateTimePicker)c).Name);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
<br>
问: 我想学c#,有好书推荐么?<br>
答: (a)《C#高级编程》<br>
&nbsp;&nbsp;&nbsp;&nbsp;(b)看.NET SDK,比哪本书都好!<br>
<br>
问:C#中如何判断字符串中不含全角字符 <br>
答:判断ASCII是否大于255如果大于则为全角字符<br>
<br>
问:DataGrid的DataSource一定是DataSet吗?可以自己操作DataGrid而不是通过数据绑定<br>
答:赋值<br>
&nbsp;&nbsp;&nbsp;dgExample[ rowNum, colNum ] = &quot;aaaa&quot;;<br>
&nbsp;&nbsp;&nbsp;&nbsp;取值<br>
&nbsp;&nbsp;&nbsp;string cellValue = dgExample[ rowNum, colNum ].ToString()<br>
&nbsp;&nbsp;&nbsp;实际上操作datagrid也就是操作其对应的数据源的DataTable<br>
&nbsp;&nbsp;&nbsp;你自己建一个DataTable,然后操作Column和Row就可以了,最后绑定到DataGird <br>
<br>
问:如何获取DataTable中DataRowState不等于Delete的总行数?<br>
答:myTable.DataView.RowStateFilter=DataViewRowState.Deleted;<br>
&nbsp;&nbsp;&nbsp;int UndeleteRowCount=myTable.Rows.Count -myTable.DataView.Count<br>
<br>
问:请问c#如何创建不规则窗体<br>
答:可以通过Form.Region 来实现<br>
&nbsp;&nbsp;&nbsp;http://www.codeproject.com/csharp/shapedform.asp<br>
<br>
问:如何判断今天是这个星期的第几天?<br>
答:DateTime.Now.DayOfWeek.GetHashCode()<br>
&nbsp;&nbsp;&nbsp;或者int intDayOfWeek=(int)DateTime.Now.DayOfWeek;<br>
<br>
问: 如何取得字符串中某个字符的ASCII码?<br>
答: int a='a';可以得到a的AscII码<br>
<br>
问:如何屏蔽winform的随意拖动大小功能阿<br>
答:改变一下FormBorderStyle 为 FixedSingle<br>
<br>
&lt;答案有错误的请
<script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 728x15, 创建于 08-4-23MSDN */ google_ad_slot = "3624277373"; google_ad_width = 728; google_ad_height = 15; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 160x600, 创建于 08-4-23MSDN */ google_ad_slot = "4367022601"; google_ad_width = 160; google_ad_height = 600; //--> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
阅读更多
个人分类: .net
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭