随笔分类 - C# .Net
摘要:一、思路 1.使用ScrollView的Scroll.ScrollToVerticalOffset(offset)方法进行滚动 2.ScrollView中放置2个ListView,第一个滚动出边界后,移除,然后再动态添加一个内容相同的ListView 3.ListView设置最小高度,以保证在内容不
阅读全文
摘要:错误示范: 正确示范: 两者区别在于on条件中,第一个条件new的对象要加入字段名
阅读全文
摘要:有一个需求是DataGridView中不符合要求的行变为红色,这网上查到的代码是 Row.DefaultCellStyle.BackColor = Color.Red;即可 但是写完之后发现不起作用 经过不断尝试,将此代码放在Form的Activated方法中即可生效,但放在构造方法中是不起作用的
阅读全文
摘要:原因:自动生成的类中有关联主键,没有自动生成Key及Column 解决方法:在xxx.tt的66行左右修改为
阅读全文
摘要:public void DoMerge(string[] source) { Microsoft.Office.Interop.Excel.Application sourceApp = new Microsoft.Office.Interop.Excel.Application(); Workbo
阅读全文
摘要:修改AssemblyInfo.cs 1.注释[assembly: AssemblyFileVersion("1.0.0.0")] 2.[assembly: AssemblyVersion("1.0.*")] 通过版本号可实现自动更新
阅读全文
摘要:1.在nuget控制台中执行:Enable-Migrations2.将出现的configuation.cs文件中的AutomaticMigrationsEnabled属性改为true3.在nuget中执行Update-Database
阅读全文
摘要:1.View显示return View();默认为/Views//return View("Test");显示/View//Test.cshtmlreturn View("~/Views/AAAA/BBB.cshtml");显示/View/AAAA/BBB.cshtml
阅读全文
摘要:1.Inner Join(默认)var Goods = from goods in db.T_Goods join types in db.T_GoodsType on goods.GoodsType equals types.GoodsTypeID join priceinfo in db.T_P...
阅读全文
摘要:常用的调用方法为Get/PostGet方法:服务器public string Get(int id){ return "value";}这个直接在网页就可以测试,用 http://地址/api/xxx(Controller名,即xxxController的xxx部分)?id=x即可看到返回值调...
阅读全文
摘要:1.增加数据PirateBayEntities db = new PirateBayEntities();T_Tests test = new T_Tests();test.Name = "老李";test.Age = 20;db.T_Tests.Add(test);db.SaveChanges()...
阅读全文
摘要:1.添加项,选择ADO.NET实体数据模型2.选择从数据库生成3.建立数据库连接4.选择要关联的表点击完成,数据库已连接完毕,并生成了对应的Model
阅读全文
摘要:新建.net mvc api项目后,直接运行,默认会访问http://localhost:xxxx/Home/Index页面,这个页面不是要访问的API页面。从项目的目录可以看出,默认的API页面访问地址为http://localhost:xxxx/api/values目前返回的内容为xml格式,要...
阅读全文
摘要:1.清了C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files 2.给上述文件夹EveryOne和IIS_User完全控制权限 3.给C:\Windows\Temp文件夹IIS_User完全控制权限
阅读全文
摘要:OPC客户端操作主要有4个步骤:1.连接OPC服务器2.创建组和项3.读写数据4.断开服务器连接全部代码:View Code using System;using System.Collections.Generic;using System.Net;using System.Threading;using OPCAutomation;namespace ConsoleOPC{ public class OPCClient { private OPCServer KepServer; private OPCGroups KepGroups; ...
阅读全文
摘要:症状:打开WINCE程序时,报错:数据存储中找不到关于指定平台的信息解决方法:新建一个WINCE程序,打开csproj文件,复制PlatFormID一项的值到要打开的csproj文件中替换原有PlatFormID即可参考:http://mengyihh.blog.163.com/blog/static/123503620100602219372/
阅读全文
摘要:1.在windows程序下,可使用如下代码播放ResourceManager rm = new ResourceManager( "WindowsFormsApplication1.Form1" , Assembly.GetExecutingAssembly() ); SoundPlayer sndplayr = new SoundPlayer( rm.GetStream( "ErrorSound" ) );sndplayr.Play();其中WindowsFormsApplication1为命名空间,Form1为资源文件所在类,ErrorSound为声
阅读全文
浙公网安备 33010602011771号