DotNet_C#
poloyzhang
这个作者很懒,什么都没留下…
展开
-
获得硬盘 , 如果有两块也一并列出.
获得硬盘 , 如果有两块也一并列出. /// <summary> /// 获取硬盘序列号 /// </summary> public string GetDiskSerialNumber() { //这种模式在插入一个U盘后可能会有不同的结果,如插入我的手机时 String HDid = ""; ManagementClass原创 2021-02-07 23:05:16 · 175 阅读 · 0 评论 -
开始Dot 学习之旅!!C#绘图
笔记和理解. 面向对象的基础知识 消息之间的传递之类总结. 1.通过函数, new newObject( ).Method() ; 2. 静态变量, new newObject().staticValue; 具体待续,原创 2008-09-10 08:19:00 · 503 阅读 · 0 评论 -
学习dotnet第四课关于绘图的自己做的实例源代码,存在这儿,方便复习.
实心画笔填充的图形 private void buttonUseBrush_Click(object sender, EventArgs e) { Graphics g = panel1.CreateGraphics(); Brush fillBrush = new SolidBrush(Color.Red);原创 2008-09-13 18:27:00 · 421 阅读 · 0 评论 -
从老师的源代码中学到的. 化整为零, 易于代码维护和阅读
多个语句太多,能化整为零最好, 分成两句或更多. private void button1_Click(object sender, EventArgs e) { lblN.Text = f(Convert.ToInt32(textBoxN.Text)).ToString(); } private long f(i原创 2008-09-11 07:13:00 · 641 阅读 · 0 评论 -
参考MSDN只能列出指定文件下的文件.红色的为增加的
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.IO;namesp原创 2008-09-12 06:36:00 · 390 阅读 · 0 评论 -
控制台程序, 递归求指定文件夹下的文件和目录
参考MSDN 我把原 args 数组改为单个 string 组. using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.IO;namespace TestControl{ class Program { static v原创 2008-09-11 21:35:00 · 401 阅读 · 0 评论 -
学习dotnet第五课后作出的绘图程序
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace MyDrawCircle原创 2008-09-18 21:20:00 · 440 阅读 · 0 评论 -
ASP.NET技术的学习顺序问题
ASP.NET技术的学习顺序问题 前前后后收到过一些学生的来信,询问ASP.NET的学习顺序问题,在此就向打算系统学习ASP.NET技术的初学者谈谈我的建议。 如果你已经有较多的面向对象开发经验,跳过以下这两步:第一步 掌握一门.NET面向对象语言,C#或VB.NET。 我强烈反对在没系统学过一门面向对象(OO)语言的前提下去学ASP.NET。转载 2008-09-21 08:34:00 · 437 阅读 · 0 评论 -
CSS学习参考
General.cssbody{}#banner{ text-align: center; margin-bottom: 10px; background-image: url(images/Banner.jpg); color: Red; font-size: 12px; height: 30px; vertical-align: middle;原创 2008-10-21 09:08:00 · 454 阅读 · 0 评论 -
使用javascript处理控件的连动功能
//激活或屏蔽控件 function EnableTextControl( Id, IsEnabled ) { var txt = document.getElementById( Id ); if( txt){ txt.disabled = IsEnabled; } }原创 2009-01-08 08:03:00 · 486 阅读 · 0 评论 -
表单的双向传递消息, VB /C#
//VB 下的窗体消息的双向传递 Public Class frmMain Dim frm As frmOther 引用从窗体 Public Sub New() 此调用是 Windows 窗体设计器所必需的。 InitializeComponent() 在 InitializeComponent() 调用之后添加任原创 2009-01-10 09:28:00 · 566 阅读 · 0 评论 -
主窗体累积从窗体的点击次数
//主窗体代码using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace sho原创 2009-01-10 10:15:00 · 639 阅读 · 0 评论 -
表单的通信--主窗体消息传送到从窗体
要求: 主窗体一个文本框,然后从窗体一个label , 文本框输入文字,从窗体显示出来在label上. 主从窗体互相通信的话,从窗体要显示主窗体的信息,则从窗体必须有主窗体的实例. 用主窗体在从窗体的实例调用主窗体写好的一个方法, 例如 public string getMsg()返回的值来赋给label 即可. label.Text = mainFrm.getMsg();原创 2009-04-28 09:52:00 · 409 阅读 · 0 评论 -
Substring 的一些简单用法
string testString = abc:def; testString.Substring( 2 ); // return c:def;testString.Substring( testString.LastIndexOf( ":" ) + 1 ); //return deftestString.Substring( testSt原创 2009-09-29 08:03:00 · 469 阅读 · 0 评论 -
数据验证ASP.NET 简单使用
use RangeValidator 验证数据在一定的范围内 关键属性: MaximumValue MinimumValue 其它属性: ControlToValidate: 指向需验证的控件. 例如文本框 Display: 动态/静态显示 Dynamic ErrorMessage: 输入错误信息原创 2009-10-12 10:42:00 · 474 阅读 · 0 评论 -
一般处理程序生成验证码
DrawingOnWebPage.ashx页 using System;using System.Collections;using System.Data;using System.Linq;using System.Web;using System.Web.Services;using System.Web.Services.Protocols;us原创 2009-10-21 15:32:00 · 723 阅读 · 0 评论 -
一般处理程序生成图像
using System;using System.Collections;using System.Data;using System.Linq;using System.Web;using System.Web.Services;using System.Web.Services.Protocols;using System.Xml.Linq;using Sys原创 2009-10-21 13:27:00 · 423 阅读 · 0 评论 -
组件化开发-用户控件开发-服务器控件开发
public partial class _Default : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) UserInput1.InputString = "请输入一个字串";原创 2009-10-24 06:23:00 · 477 阅读 · 0 评论 -
CLR 无法从 COM 上下文 0x318638 转换为 COM 上下文 0x3187a8,这种状态已持续 60 秒
<br />CLR 无法从 COM 上下文 0x318638 转换为 COM 上下文 0x3187a8,这种状态已持续 60 秒。拥有目标上下文/单元的线程很有可能执行的是非泵式等待或者在不发送 Windows 消息的情况下处理一个运行时间非常长的操作。这种情况通常会影响到性能,甚至可能导致应用程序不响应或者使用的内存随时间不断累积。要避免此问题,所有单线程单元(STA)线程都应使用泵式等待基元(如 CoWaitForMultipleHandles),并在运行时间很长的操作过程中定期发送消息。<br />原创 2010-07-21 13:20:00 · 6217 阅读 · 1 评论 -
省市数据--类的方式读取
省市数据库的代码样例原创 2011-05-13 12:51:00 · 555 阅读 · 0 评论 -
从别处转的一个sqlite 仿 sqlserver 的类. 没有Demo
<br />从别处转的一个sqlite 仿 sqlserver类. 但是没有Demo<br /> <br />class SQLiteHelper<br /> {<br /><br /> /// <summary><br /> /// Creates a new <see cref="SQLiteHelper"/> instance. The ctor is marked private since all members are static.<br />原创 2011-06-01 15:49:00 · 729 阅读 · 0 评论 -
DataGridview add Combobox
using System;using System.Data;using System.Data.SqlClient;using System.Windows.Forms;using System.Collections.Generic;using System.Drawing;public class Employees : Form{ private DataGridV原创 2013-09-28 20:56:55 · 1159 阅读 · 0 评论 -
读取连接字符串
using System.Configuration;this.cboxConn.Text.Trim() /// string getValue class DbConnection { private static string currentConnectionString = ConfigurationManager.ConnectionString原创 2012-09-24 17:52:18 · 411 阅读 · 0 评论 -
DataGridview 获得当前单元格的行号和列号.
private void dataGridView1_CellEnter(object sender, DataGridViewCellEventArgs e) { iTag = (int)this.Tag; //if (iTag == 4) //{ // if原创 2013-10-12 17:55:12 · 11939 阅读 · 0 评论 -
连接字符串的写法.
1.C#连接连接Access程序代码:-------------------------------------------------------------------------------using System.Data;using System.Data.OleDb;......string strConnection="Provider=Microsoft.Jet.原创 2012-09-24 17:50:36 · 756 阅读 · 0 评论 -
VBA --Sheets.Add 方法
Excel 开发人员参考Sheets.Add 方法新建工作表、图表或宏表。新建的工作表将成为活动工作表。语法表达式.Add(Before,After,Count,Type)表达式 一个代表 Sheets 对象的变量。参数名称必选/可选数据类型说明Before可选Variant指定工作表的原创 2011-12-13 09:25:46 · 29992 阅读 · 0 评论 -
VB中DateDiff 函数解释
VB中DateDiff 函数用法DateDiff (interval, Date1 , Date2[,firstweekofyear[,firstweekofyear]]) 返回一个Variant(long) 的值,表示两个指定日期间的时间间隔数目interval:设定两个日期之间的期间计算之单位。譬如 >interval="m" 表示计算的单位为月。 >interva原创 2011-11-22 11:02:06 · 39438 阅读 · 0 评论 -
ReDim 语句
ReDim 语句ReDim 语句示例该示例使用 ReDim 语句为动态数组变量分配和重分配存储空间。假设 Option Base是 1。Dim MyArray() As Integer '声明动态数组。Redim MyArray(5) '分配 5 个元素。For I = 1 To 5 '循环 5 次。 MyArray(I) = I '初始原创 2011-12-09 13:46:33 · 3025 阅读 · 0 评论 -
常用的VBA函数及语句
清除行内容 Rows("2:2").Select Selection.ClearContents 粘贴到另一个表中有字符的下一行或粘贴到最后一行字符的下一行:该行的行号为: Sheets("sheet1").Range("A65536").End(xlUp).Row + 1得到最后一行 : ActiveSheet.UsedRange. Item原创 2011-11-25 17:28:49 · 3679 阅读 · 0 评论 -
VBA 字符串的处理方法
--------------本贴收集VBA 及EXCEL 字符串的处理方式案例: 有一个excel 表 , 保存的是邮件列表.如下:地址:aaaa@123.combbbb@123.com需要截取@字符前的字符直接右边在单元格输入如下即可.=LEFT(RC[-1], FIND("@",RC[-1])-1) 或者 LEFT(A1,FIND("原创 2012-01-11 10:49:07 · 729 阅读 · 0 评论 -
获取CPU的编号和网卡地址
获取cpu序列号代码string cpuinfo = "";//cpu序列号 managementclass cimobject = new managementclass("win32_processor"); managementobjectcollection moc = cimobject.getinstances(); foreach(managementob转载 2012-09-24 17:46:14 · 593 阅读 · 0 评论 -
VBA 中类 Arraylist 的对象
Dictionary 对象描述对象,用于存储数据关键字和条目对。语法Scripting.Dictionary说明Dictionary 对象与 PERL 关联数组等价。可以是任何形式的数据的条目被存储在数组中。每个条目都与一个唯一的关键字相关联。该关键字用来检索单个条目,通常是整数或字符串,可以是除数组外的任何类型。下面的代码举例说明了如何创建一个 Diction原创 2011-12-12 09:03:22 · 18725 阅读 · 0 评论 -
C# 托盘图标. notifyIcon 用法
// *************************************************************************************** //Application.Exit(); this.Hide(); notifyIcon1.Visible = true原创 2013-05-07 16:36:18 · 976 阅读 · 0 评论 -
VBA 文本框按Enter 键触发事件.
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)TextBox2.Value = "ok"TextBox3.SetFocusEnd Sub注意: userForm 中有一个默认回车时, 自动是激活某一按钮按钮的属性有一项是default 将其设成TRU原创 2012-08-22 20:29:44 · 20090 阅读 · 0 评论 -
将日期时间转换为指定格式
#region 将日期转换成指定的格式 /// /// 将日期转换成yyyy-mm-dd格式. /// /// 日期 /// 返回String对象 public string Date_Format(string NDate) { string sm, sd原创 2013-10-09 14:43:40 · 4912 阅读 · 0 评论 -
复制自动筛选后的数据区域
将 sheet1表中筛选的区域复制到sheet2 表中.Sub copyFilterResult(ByVal sheet1Obj, ByVal sheet2Obj) 'sheet1 filter result copy to sheet2 With Worksheets(sheet1Obj) If .FilterMode Then .Auto原创 2011-12-18 11:04:53 · 1954 阅读 · 0 评论 -
Datagridview add Combobox 2
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using Sy原创 2013-10-09 11:01:03 · 939 阅读 · 0 评论 -
C#进度条--调用存储过程进度条的制作
C# 调用存储过程 缘由: 因做核销系统为了使数据更新更快, 所以设计时把更新及数据联动做成了存储过程. 但是调用时存储过程无法得到实时的进度, 软件执行存储过程有时候一分多钟,客户端看起来无响应,那么如何做呢. 实现方法: 那么我们可以做一个假的进度条, 让程序在后台执行, 进度条在前台显示,这样更人性化一些. 存储过程完成,进度条也自动停止,显示完成.原创 2012-07-15 09:54:57 · 4152 阅读 · 0 评论 -
//分离路径 文件名 后缀名
//分离路径 文件名 后缀名 OpenFileDialog openFileDialog1 = new OpenFileDialog(); public void splitPathFileNameSuffix() { openFileDialog1.Filter = "All files(*.*)|*.*"; //设置原创 2012-09-25 17:10:07 · 739 阅读 · 0 评论 -
以数组为参数的方法
以数组为参数的方法 public static void checkIsNumericParam(DataGridView dgv, params string[] headParam) { if (dgv.Rows.Count <= 1) return; foreach (DataGridVie原创 2012-09-24 17:48:17 · 551 阅读 · 0 评论