C#委托调用实例
2013-12-20 13:35
176 查看
最近学习了委托的使用,为了加深了解,下面使用委托方式,新建个winform,施一个button1,一个textbox1设置TextBox.Text实例,在vs2010下测试通过
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 委托实例 { public partial class Form1 : Form { delegate void MyDeleGate(string s); //1.定义委托结构 MyDeleGate mdg; //2.定义委托 //3.定义委托方法 public void func(string s) { textBox1.Text = s; } public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { //4.梆定委托方法 mdg= new MyDeleGate(func); //5.调用委托 mdg("那是一阵风"); } } }
相关文章推荐
- C#委托调用过程(实例)
- C#委托事件定义调用实例
- C#委托调用实例 .
- Android获取其他包的Context实例,然后调用它的方法
- echarts实例,前后台数据调用
- 在IIS上发布一个WebService,再发布一个网站调用这个WebService(实例)
- java通过字符串调用方法,java反射应用实例
- 微服务实战之春云与刀客(三)—— 面向接口调用代码结构实例
- 使用XFire创建WebService实例、C#调用
- C#调用oracle存储过程 最简单的实例
- Magento调用静态块(static block) 实例
- webservice通信调用天气预报接口实例
- Android Touch系统简介(二):实例详解onInterceptTouchEvent与onTouchEvent的调用过程
- PHP调用MYSQL存储过程实例
- ASP.NET Ajax实例—Javascript直接调用服务器C#代码
- CXF动态客户端调用webservice实例
- 在ASP.NET Atlas中调用Web Service——创建Mashup调用远端Web Service(Google Search实例)
- java实现异步调用实例
- R调用C语言简单实例
- Kindeditor单独调用多图上传实例