摘要: //功能:搞懂C#类的实例化顺序(先声明类中变量,再执行构造函数) class MyClass { public MyClass(int a) //3. 然后才是执行构造函数 { val = a; } public int val = 20; //1. 首先声明int型变量val并赋值20 publ 阅读全文
posted @ 2019-07-29 19:16 向前追起 阅读(973) 评论(0) 推荐(0)
摘要: //Attribute namespace SfcEnd_PCK_DIP{ class Attribute { public string BoarBC { get; set; } public string TASN { get; set; } public string WLID { get; 阅读全文
posted @ 2019-07-29 13:30 向前追起 阅读(484) 评论(0) 推荐(0)
摘要: DataGridView的几个基本操作:1、获得某个(指定的)单元格的值:dataGridView1.Row[i].Cells[j].Value;2、获得选中的总行数:dataGridView1.SelectedRows.Count;3、获得当前选中行的索引:dataGridView1.Curren 阅读全文
posted @ 2019-07-26 19:05 向前追起 阅读(14967) 评论(0) 推荐(1)
摘要: /// <summary> /// 学员类 /// </summary> class Student { //字段:学员 private int studentld; //字段:学员姓名 private string studentName = string.Empty; //属性:学号 publi 阅读全文
posted @ 2019-07-26 09:34 向前追起 阅读(392) 评论(0) 推荐(0)
摘要: 一、函数 1、c#中如何取字符串最左边和最右边的n个字符?? string left = str.Substring(0, n);string right = str.Substring(str.Length - n); 2、去掉左边N个字符 string right = str.Substring 阅读全文
posted @ 2019-07-19 11:30 向前追起 阅读(11119) 评论(0) 推荐(1)
摘要: 最大化:this.WindowState = FormWindowState.Maximized;原始大小:this.WindowState = FormWindowState.Normal;最小化:this.WindowState = FormWindowState.Minimized; 阅读全文
posted @ 2019-07-16 13:07 向前追起 阅读(10846) 评论(0) 推荐(2)
摘要: 第一步:把Form2里面的TextBox控件modifiers属性改为public第二步:在Form1中加代码 private Form2 ff; private void Form1_Load(object sender, EventArgs e) { ff = new Form2(); ff.S 阅读全文
posted @ 2019-07-13 21:24 向前追起 阅读(3687) 评论(2) 推荐(0)
摘要: Xml文件: <?xml version="1.0" encoding="utf-8" ?><configuration> <TestGroup> <Test> <add key="Hello" value="World"/> </Test> </TestGroup></configuration> 阅读全文
posted @ 2019-07-13 00:59 向前追起 阅读(784) 评论(0) 推荐(0)
摘要: 1、DateTime 数字型 System.DateTime currentTime=new System.DateTime();1.1 取当前年月日时分秒currentTime=System.DateTime.Now;1.2 取当前年int 年=currentTime.Year;1.3 取当前月i 阅读全文
posted @ 2019-07-11 13:05 向前追起 阅读(411) 评论(0) 推荐(0)
摘要: var 局部变量 = 1; //var只能声明局部变量,由编译器根据表达式推断类型(又称为"隐式类型") //下面的两种写法都是等价的,后一种直接引用System的类型,需要导入System命名空间 //任意对象类型,可变的引用类型 object o = 1; Object O = 1; //布尔型 阅读全文
posted @ 2019-07-11 13:04 向前追起 阅读(736) 评论(0) 推荐(0)