随笔分类 - C# Winform
摘要:ASP.NET+Access一、登入部分主界面 Fm = new 主界面(); string s1 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=student.mdb"; string s2 = "select*from 登录信息表 where 用户名='" + this.ttbName.Text + "' and 密码 ='" + ttbPwd.Text + "'and 身份='" + cbbId.Text + "
阅读全文
摘要:如何实现语音和朗诵的功能:using System;using System.Windows.Forms;using System.IO;using System.Media;using System.Runtime.InteropServices;namespace 播放TTS{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } //根目录 string address = System.AppDomain.CurrentDomain.BaseDirectory; private voi
阅读全文
摘要:如何添加数据库中的信息加载到树形控件中?如何遍历控件中的信息?如何对控件中的信息进行增删查改?数据库设计:主界面:代码:using System;using System.Collections.Generic;using System.Windows.Forms;using TreeSolution.BLL;using TreeSolution.Model;namespace 树型测试{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } //当窗体加载时,加载树形节点 private v
阅读全文
摘要:Winform特有的功能如何保存当前窗口中所填的信息,方便下次打开 还是这样的,实现如下:首先,在当前项目中打开Properties——Settings.settings,然后点击,添加字段;其次,再点击界面中控件的属性,然后选择ApplicationSettings属性,选Text属性,选择刚刚设置的字段最后,用一个事件来实现数据保存,代码:Settings.Default.Save();实现了需要的功能
阅读全文
摘要:using System;using System.Windows.Forms;namespace TreeView控件{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { treeView1.Nodes.Clear(); //每一个节点都是一个TreeNode的一个对象 TreeNode nodeChina = new TreeNode(); nodeChina.Text =
阅读全文
摘要:/// /// 复合查询 /// /// /// private void btnCheck_Click(object sender, EventArgs e) { //方法一 //StringBuilder sb = new StringBuilder(); //sb.Append("select * from T_Customers where 1=1\n"); //if (ckbName.Checked) //{ // sb.Append("and Name like @name\n"); //} //if (ckbPhone.Checked) /
阅读全文
摘要:当我们遇到要处理汉字和拼音之间的转化关系怎么办?如和用程序来实现?我搜索到一个ChineseChar开发包,然后实现了这一难题using System;using Microsoft.International.Converters.PinYinConverter;namespace 拼音基础{ class Program { static void Main(string[] args) { #region 判断是否为同音字 ChineseChar chineseChar = new ChineseChar('微'); Console.WriteLine("Stro
阅读全文
摘要:using System;using System.Windows.Forms;using System.Security.Cryptography;using System.IO;namespace 计算文件的MD5{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { //创建与服务器的连接 FtpClient fc = new FtpClient("127.0.0
阅读全文
摘要:1.通过构造函数特点:传值是单向的(不可以互相传值),实现简单实现代码如下:在窗体Form2中int value1;string value2;public Form2 ( int value1 , string value2 ){ InitializeComponent ( ); this.value1 = value1; this.value2 = value2;}在窗体Form1中这样调用new Form2 ( 111 , "222" ).Show ( ); //这样就把111,"222",这2个值传送给了Form22.通过静态变量特点:传值是双向
阅读全文
摘要:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Net;using System.Net.Sockets;namespace SocketTest{ class Program { static void Main(string[] args) { int length; byte[] bytes = new byte[1024]; //创建一个Socket对象 Socket socketSend = new Socket(AddressFamily.I
阅读全文