![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C#
creay_king
这个作者很懒,什么都没留下…
展开
-
试图运行项目时出错:无法启动程序,调试器不支持此平台调试托管代码和本机代码
从别人的电脑上拷贝了一个项目到我的电脑上,出现以下错误,好不容易找到解决方法,特此记录。解决方法:找到exe的生成项目,单击右键,选择属性,进入下面的界面:在生成选项卡中将目标平台选择x86,及解决此问题。...原创 2018-05-09 13:59:35 · 2053 阅读 · 0 评论 -
WPF将DataGrid导出到Excel表格
将DataGrid转换成DataTabel,我这里因为项目的特殊性,这样转换,也有其他方法直接转换。public void Export(DataGrid dgData, DataTable dataTable, string excelTitle) { DataTable dt = new DataTable(); for (int...原创 2018-05-06 11:33:09 · 2760 阅读 · 0 评论 -
WPF 读写自己写的配置文件
将其封装成类,供以后使用。命名空间:using System.Collections.Generic;using System.Configuration;using System.Linq;类:public class Config { public Configuration configObject; /// <su...原创 2018-05-05 17:28:51 · 6064 阅读 · 1 评论 -
将WPF应用程序生成dll库供项目使用
如题,见下图:WPFTest为新建的WPF应用程序项目,将App.xmal和MainWindow.xmal删除,然后单击右键选择属性,进入如下界面:将输出类型改为库类,最后在需要使用的项目中引用该dll库,在需要使用的地方添加命名空间即可。...原创 2018-05-05 17:03:12 · 5405 阅读 · 1 评论 -
WPF创建类库
如题,见下图:该图为初学测试项目,啥效果没有。主要记录方法:1.首先创建项目EFDemo;略。2.在解决方案下添加新建项目,选择类库,命名(我这里出于测试,默认ClassLibrary1);3.在EFDemo项目的引用添加刚创建的ClassLibrary1类库,然后在项目中需要用到该库类的地方添加命名空间:using ClassLibrary1即可;注意:类库中新建的类需要添加public权限,否...原创 2018-05-05 16:55:19 · 3490 阅读 · 0 评论 -
C# 操作字符串的方法总结
方便查阅string s =""; //(1)字符访问(下标访问s[i]) s ="ABCD"; Console.WriteLine(s[0]); // 输出"A"; Console.WriteLine(s.Length); // 输出4 Console.WriteLine();...原创 2018-05-05 10:43:11 · 149 阅读 · 0 评论 -
WPF 关闭子窗口时刷新父窗口
关闭子窗口后子窗口进行某个操作后刷新父窗口父窗口:/// <summary> ///弹出窗口 /// </summary> /// <param name="sender"></param> /// <param name="e"></param&am原创 2018-05-05 10:40:39 · 4038 阅读 · 0 评论 -
WPF datagrid数据导出到Excel表格
封装成类,供以后使用(将datagrid导出)using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Controls;namespace AstroATE{ clas...原创 2018-05-05 10:36:03 · 2726 阅读 · 4 评论 -
WPF UDP Socket通信
直接上代码:xmal:<Window x:Class="UDPSocket.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Ti...原创 2018-05-05 10:19:40 · 4278 阅读 · 0 评论 -
C# 遍历文件夹中的文件夹
直接上代码:string debug = System.AppDomain.CurrentDomain.BaseDirectory; string proj = System.IO.Path.Combine(debug, @"..\..\"); foreach (string folder in System.IO.Directory.GetDire...原创 2018-05-04 21:48:05 · 211 阅读 · 0 评论 -
C# 定时器的使用
命名空间:using System.Timers;在类中创建定时器:private Timer timer = new Timer(3000);程序中使用定时器://启动定时器 timer.Elapsed += new ElapsedEventHandler(timer_Elapsed); timer.Start();void timer_Elaps...原创 2018-05-06 18:00:19 · 848 阅读 · 0 评论