随笔分类 - WinForm/c/s
摘要:this.c1FlexGrid1.DataSource = BLL_Pos_InOutMoney.PosInOutMoneyQuery(computer, payKind, inoutType, oprtid, dptid, start, end).Tables[0]; c1FlexGrid1.Cols["收入"].Format = string.Format("C"); c1FlexGrid1.Cols["支出"].Format = string.Format("C"); C1AfterFilter...
阅读全文
摘要://获取客户端的IP地址 TextBox1.Text = Request.UserHostAddress; //获取服务器的主机名 string hostName = Dns.GetHostName(); //获取服务器的IP地址 IPAddress[] ips; ips = Dns.GetHostAddresses(hostName); foreach ( IPAddress ip in ips) { TextBox2.Text = ip.ToString(); }
阅读全文
摘要:在命名空间using System.Net.Mail中提供方法根据指定的smtp服务器来发送邮件。下面说说如何实现:1、首先要发送邮件,需要有一个邮箱帐号,比如网易邮箱、新郎邮箱、qq邮箱等,我以网易的163邮箱为例。然后我们需要知道163邮箱的smtp服务器地址:smtp.163.com。一般常用的Smtp服务器地址为:网易126:smtp.126.com网易163:smtp.163.com搜狐:smtp.sohu.com新浪:smtp.sina.com.cn雅虎:smtp.mail.yahoo.com2、现在我们可以开始实现了。在新建的C# Console Application中,需要加
阅读全文
摘要:当我们在一个text文本框里面输入一个计算公式,比如:(2+3)*4+(5-4)的时候,要怎么样来计算这个公式的结果?看了很多文章,多数都要求解释这个计算公式,然后计算。这里就不多说了,因为我也不怎么懂怎么转换,按大多数帖子的说法,我就是那种编译原理没学好的人。不过看到一些有独特见解的说法:我们可以把公式放在SQL里面执行,也就是说我们在程序里面用SQL语句执行 "select '(2+3)*4+(5-4)'",那么数据库将给我们返回一个计算结果。这种方法很简便。但前提是要求连接数据库才能用。不过有了这个想法,就方便多了。在C#中有个DataTable,它有
阅读全文
摘要:调用窗体(父):Form1,被调用窗体(子):Form2 方法1: 所有权法 //Form1: //需要有一个公共的刷新方法 public void Refresh_Method() { //... } //在调用Form2时,要把Form2的所有者设为Form1 Form2 f2 = new Form2() ; f2.Owner = this; f2.ShowDialog() ; //Form2: //在需要对其调用者(父)刷新时 Form1 f1 ; f1 = (Form1)this.Owner; f1.Refresh_Metho...
阅读全文
摘要:第一我先建好一个控件 有三个下拉框分别命名为:cboxYear,cboxMonth,cboxDay;后台代码如下: #region 获取选定的年 private string strCboxYear; public string StrCboxYear { get { return cboxYear.Text.Trim(); } set { strCboxYear= value; } } #endregion #region 获取选定的月份 priv...
阅读全文
摘要:public Form1() { InitializeComponent(); #region AddStatusStrip //1. 定义要增加的StatusStrip StatusStrip sb = new StatusStrip(); //2. 定义StatusStrip项目中的控件,其中ToolStripLabel是一個相似於label的控件,現在用於顯示文字 ToolStripLabel tsl = new ToolStri...
阅读全文
摘要:说实话以前没做过C/S方面的项目 ,只是做ASP.NET WEB方面的工作,虽然 说C/S在学校学过一点,但只是皮毛。比如网上常见的登录窗体到主窗体关闭登录窗体 ,窗体传值刷新父窗体....总结如下:1、登录到主窗体 并关闭登录 窗体在programm.cs修改代码: static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main(...
阅读全文
摘要:网络上有几种方法,先总结如下:调用窗体(父):Form1,被调用窗体(子):Form2方法1: 所有权法//Form1://需要有一个公共的刷新方法public void Refresh_Method(){//...}//在调用Form2时,要把Form2的所有者设为Form1Form2 f2 = new Form2() ;f2.Owner = this;f2.ShowDialog() ;//Form2://在需要对其调用者(父)刷新时Form1 f1 ;f1 = (Form1)this.Owner;f1.Refresh_Method() ;方法2:自身传递法//Form1://需要有一个公共
阅读全文
摘要:首先在programm.cs里设置登录窗体显示 static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefaul...
阅读全文
摘要:C# ArrayList的用法System.Collections.ArrayList类是一个特殊的数组。通过添加和删除元素,就可以动态改变数组的长度。一、优点1. 支持自动改变大小的功能2. 可以灵活的插入元素3. 可以灵活的删除元素4. 可以灵活访问元素二、局限性跟一般的数组比起来,速度上差些三、添加元素1.public virtual int Add(object value);将对象添加到ArrayList的结尾处ArrayList aList=new ArrayList();aList.Add("a");aList.Add("b");aList
阅读全文
摘要:using System;using System.Collections;using System.Collections.Generic;using System.Data;using System.Text;using System.Data.SqlClient;using System.Data.OleDb;using System.IO;namespace JC.DAL{ public class DbHelperSQL { public static SqlConnection Conn; public static bool TestCon...
阅读全文
摘要:private bool IsExistsItem(string text) { foreach(ListViewItem item in listView1.Items) { if(item.Text==text) return true; } return false; } 当窗体中的textbox控件发生回车事件时,向ListView中添加输入的数据: //调用 ListViewItem list = new ListViewItem(); list.Text = textBoxBarcode.T...
阅读全文
摘要:看了很多的传值方法 ,自己用的以下的方法 :首先有数据显示窗体A 和编辑用户信息窗体B双击A窗体中的某一行 弹出B窗体 并显示A窗体点击某行的信息;第一步:在A窗体中写以下代码: private static string strTxtName; private static string strTxtPass; public string passText { get { return strTxtPass; } } public string userText { ...
阅读全文
摘要:我们在程序中经常会用到MessageBox。 MessageBox.Show()共有21中重载方法。现将其常见用法总结如下: 1.MessageBox.Show("Hello~~~~");最简单的,只显示提示信息。 2.MessageBox.Show("There are something wrong!","ERROR"); 可以给消息框加上标题。 3.if (MessageBox.Show("Delete this user?", "Confirm Message", MessageBoxB
阅读全文
摘要:datagridview单击获取当前行的ID(此ID为数据库的ID)dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString()如果想获取当前行的索引:dataGridView1.CurrentRow.index------------------------------------------------------------DataGridView中CellClick的使用,选中一行触发的动作可以在这个方法里执行?private void dataGridView2_CellClick(object sender, DataGridVi
阅读全文

浙公网安备 33010602011771号