Tag: visual studio 2010

WPF C#InputBox

我在网上进行了研究,但没有找到我想要或不清楚的解决方案。 我正在使用C#进行WPF应用程序。 我想弹出一个对话框,提示用户输入他/她的名字。 之后,我将跟踪名称并使用名称将一些数据保存到txt文件中。 例如, 名称输入是name =“John” 所以我有一个数据数据=“1,2,3”; 然后我将“数据”保存在John.txt文件中。 谁知道怎么做? 我认为问题是如何弹出一个对话框供用户输入名称。 谢谢!

c#word interop查找并替换所有内容

我有一些代码来替换单词2010 docx中的文本。 object fileName = Path.Combine(System.Windows.Forms.Application.StartupPath, “document.docx”); Microsoft.Office.Interop.Word.Application wordApp = new Microsoft.Office.Interop.Word.Application { Visible = true }; Microsoft.Office.Interop.Word.Document aDoc = wordApp.Documents.Open(ref fileName, ReadOnly: false, Visible: true); aDoc.Activate(); Microsoft.Office.Interop.Word.Find fnd = wordApp.ActiveWindow.Selection.Find; fnd.ClearFormatting(); fnd.Replacement.ClearFormatting(); fnd.Forward = true; fnd.Wrap = Microsoft.Office.Interop.Word.WdFindWrap.wdFindContinue; fnd.Text = “{id}”; fnd.Replacement.Text = “123456”; fnd.Execute(Replace: WdReplace.wdReplaceAll); 这没有格式化。 但是当{id}被格式化时,它不会替换文本。 如何使此代码忽略格式化?

为什么Stack Trace显示我的开发文件路径?

Visual Studio 2010 SP1,已编译的WCF应用程序,将其放在服务器上,当然它在第一次运行时出现错误(有什么新内容),将堆栈跟踪输出到日志文件。 它正在看到我的开发环境的路径。 为什么? 是因为我将它部署为Debug与Release相比还是还有别的东西,或者我是否应该更谨慎地输出Stack Traces呢? 04/09/2012 03:58:46: Error: Object reference not set to an instance of an object. at App1.Logging.LogMessageToFile(String msg, Boolean isUsingClickOnceApp) in C:\Users\robcube\Documents\Visual Studio 2010\Projects\AppWebService\App1\Logging.cs:line 63 at App1.App1Main.ConnectWebService(String description) in C:\Users\robcube\Documents\Visual Studio 2010\Projects\AppWebService\App1\International.cs:line 40 04/09/2012 03:58:46: Error: Object reference not set to an instance of an object. at App1.App1Main.UpdateActivityLog(String data, […]

Visual Studio 2012项目将于2010年开放

我已经为Visual Studio 2012中的作业创建了一个游戏,而我正在使用2010年的大学,它将无法打开! 它提到了一些关于.NET Framework 4.5的内容。 如何转换我的项目以便在2010年开放?

无法将类型’double’隐式转换为’float’

我正在做一个用开尔文,摄氏和华氏温度转换温度的简单程序,但是在用开尔文做任何事情时我都会遇到这个错误: Cannon implicitly convert type ‘double’ to ‘float’ 发生错误的行: public static float FahrenheitToKelvin(float fahrenheit) { return ((fahrenheit – 32) * 5) / 9 + 273.15; } 按钮点击: private void button1_Click(object sender, EventArgs e) { var input = float.Parse(textBox1.Text); float FahrenResult = FahrenheitToCelsius(input); textBox2.Text = FahrenResult.ToString(); float KelvinResult = FahrenheitToKelvin(input); textBox3.Text = KelvinResult.ToString(); } 我试图做的测试方法: [TestMethod] […]

无法加载文件或程序集’crystal decisions.windows.forms,version = 13.0.2000.0′

我正在开发Windows应用程序。 在这个我设计的报告模块。 每当我想在Windows 7,Windows XP和Windows Vista中查看报告时,我都会收到错误,但它适用于Windows 8。 我在部署安装程序之前采取了以下步骤 我在Windows 7中的Windows XP和.NET Framework 4.5中安装了.NET Framework 4 我安装了CRforVS_13_0_2但它的错误消息如: 您必须已安装Visual Studio 2010才能继续此安装。 和 由于错误,Visual Studio 2010安装的SAP Crystal Reports版本提前结束。 然后我安装了我的项目设置(手动创建设置,我包括所有水晶报表程序集),登录并转到报表菜单,点击打开Crystal报表的预览通过错误消息如 无法加载文件或程序集’crystal decisions.windows.forms,version = 13.0.2000.0,culture = neutral,Public keytoken = 692fbea5521e1304’或其中一个依赖项。 该系统找不到指定的文件。 请指导我如何解决此问题。

sqlite无法打开数据库文件是加密的还是不是数据库?

我正在使用sqlite数据库的Windows应用程序.net 2.0,我的连接字符串保持在app.config之类 在连接字符串中我已将密码定义为“mypassword”,如果我删除此密码一切正常,但是当我使用密码子句时,它给出了connection.open()语法错误 File opened that is not a database file file is encrypted or is not a database 我在网上搜索并发现了一些版本问题,但我只使用版本3,因为我在连接字符串中说明我也尝试删除“版本= 3”但问题仍然是相同的。 我是第一次这样做,它的解决方案是什么?

如何在表单加载时阻止检查RadioButton?

我似乎无法阻止我的表单检查我的Group Box一个单选按钮 : 如设计器所示,那里没有检查Radio Buttons 。 以下是这个简单表单的所有代码。 没有什么要求在这里或在表单的设计者中检查单选按钮 。 问:有没有办法阻止在表单加载时检查任何单选按钮 ? public ValueTypeSelector() { InitializeComponent(); radioButton1.Checked = false; radioButton2.Checked = false; radioButton3.Checked = false; radioButton4.Checked = false; radioButton5.Checked = false; radioButton6.Checked = false; button1.Enabled = false; button1.Click += clickEvent; button2.Click += clickEvent; radioButton1.Click += clickEvent; radioButton2.Click += clickEvent; radioButton3.Click += clickEvent; radioButton4.Click += clickEvent; radioButton5.Click […]

在C#中调用SQL定义的函数

我在TSQL中编写了这个标量函数: create function TCupom (@cupom int) returns float as begin declare @Tcu float; select @Tcu = sum (total) from alteraca2 where pedido = @cupom if (@tcu is null) set @tcu = 0; return @tcu; end 我想在我的C#代码中调用此函数。 这是我到目前为止所拥有的: public void TotalCupom(int cupom) { float SAIDA; SqlDataAdapter da2 = new SqlDataAdapter(); if (conex1.State == ConnectionState.Closed) { conex1.Open(); […]

删除解决方案中未使用的cs文件

我有一个很大的解决方案,并且有许多* .cs文件实际上不属于我的解决方案(不包括在csproj文件中)。 有没有办法找到所有这些并删除?