Tag: visual studio 2010

如何将Visual Studio 2010 Express C#连接到SQL Server Express

除了允许的轻量级选项(Access,SQL Compact或SQL文件)之外,是否有任何真正的解决方法可以使C#的Express版本连接到数据库选项? 正如其他地方已经指出的那样,在网络版中可以这样做。 还注意到您可以创建项目文件,在Web版本中打开它,创建连接,并使用数据库实体创建项目,然后切换回C#。 但是,作为一种解决方法,这是非常笨重的,因为似乎我可以在我的C#数据库资源管理器中保持SQL连接,这似乎与应用程序绑定,而不是任何项目,那么我将永久地能够添加到数据库而不必经常来回切换。 有没有人解决过这个问题?

为什么关闭嵌套子对话框也会关闭父对话框?

我使用ShowDialog打开一个表单作为modal dialog。 此对话框允许使用ShowDialog再次打开另一个窗体作为模式对话框。 当最里面的对话框关闭时,这也会导致其父对话框关闭。 为什么会发生这种情况,我该如何预防呢? 我已经创建了问题的hello world版本来说明这一点。 表格1: private void OpenForm2Button_Click(object sender, EventArgs e) { Form2 testForm = new Form2(); DialogResult dialogResult = new DialogResult(); dialogResult = testForm.ShowDialog(); MessageBox.Show(“Form 2 returned: ” + Convert.ToString(dialogResult)); } 表格2: … this.Form2OKButton.DialogResult = System.Windows.Forms.DialogResult.OK; this.Form2CancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; … this.AcceptButton = this.Form2OKButton; this.CancelButton = this.Form2CancelButton; … private void OpenForm3Button_Click(object sender, […]

在VS 2010中可视化类设计器中的genericsinheritance的类型参数

是否有可能在Visual Studio 2010中可视化通用inheritance的类型参数? 如果有一个类有属性的类 Dictionary DictionaryProperty 我可以选择显示该属性的基类。 但是,没有类型参数(KeyClass,ValueClass)的generics类Dictionary有一个inheritance。 我找不到任何方法来可视化类设计器中的类型参数! 有没有办法做到这一点?

如何从Visual Studio手动终止特定(正在运行)的线程

出于测试目的,我需要从Visual Studio 手动终止命名线程(在调试会话中) – 或者允许我这样做的任何其他工具? 但Visual Studio 2010中的Threads调试窗口在线程的上下文菜单中只有一个Freeze选项,而Sysinternal的ProcessExplorer只列出进程,而不是线程。 有没有办法手动杀死特定(正在运行)的线程?

在执行重建之前不会发生更改

我有一个大型的Windows应用程序。 最近,当我对源代码进行任何更改并正常运行项目时,无论是否进行调试,都不会进行更改。 我试图重建它,一切都很顺利,现在我对源代码所做的每一次更改都要重建项目然后运行它以便更改生效。 在重建解决方案之前,我也无法调试。 我的项目附在源安全控制上。 任何帮助表示赞赏。

如何在运行时设置端点

我有基于本教程的应用程序 我用来测试与服务器的连接的方法(在客户端应用程序中): public class PBMBService : IService { private void btnPing_Click(object sender, EventArgs e) { ServiceClient service = new ServiceClient(); tbInfo.Text = service.Ping().Replace(“\n”, “\r\n”); service.Close(); } //other methods } 服务主要function: class Program { static void Main(string[] args) { Uri baseAddress = new Uri(“http://localhost:8000/PBMB”); ServiceHost selfHost = new ServiceHost(typeof(PBMBService), baseAddress); try { selfHost.AddServiceEndpoint( typeof(IService), new WSHttpBinding(), […]

虽然intellisense列出了找不到定义吗?

我在Visual Studio 10中遇到了一个奇怪的错误(现在也是11)。 我有一个扩展方法 public static S Foo(this S s) where S : IEnumerable { return s; } 现在,如果我打电话 “”.Foo(); // => ‘string’ does not contain a definition for ‘Foo’ and no extension method ‘Foo’ accepting a first argument of type ‘string’ could be found (are you missing a using directive or an assembly reference?) […]

c#BindingList只读错误

我一直在努力寻找问题的可能原因,但我似乎无法找到它: 错误: System.NotSupportedException:Collection是只读的。 System.ThrowHelper.ThrowNotSupportedException(ExceptionResource资源)位于C:\ Users \ aRJiJon \ Documents \ Visual中WindowsFormsApplication1.Form1.Btn_CSVSEATINGPLAN_Click(Object sender,EventArgs e)的System.Collections.ObjectModel.Collection`1.Add(T item) Studio 2010 \ Projects \ WindowsFormsApplication_1 \ WindowsFormsApplication1 \ Form1.cs:第72行 this.dataGridView1.DefaultCellStyle.Font = new Font(“Tahoma”, 11); bindingCSVSP.DataSource = CSV_Seating_Plan; bindingCSVSP.AllowNew = true; CSV_Seating_Plan.AllowNew = true; CSV_Seating_Plan.AllowRemove = true; CSV_Seating_Plan.RaiseListChangedEvents = true; CSV_Seating_Plan.AllowEdit = true; this.dataGridView1.DataSource = bindingCSVSP; this.btn_Process_SP.Enabled = true; CSV_Seating_Plan.Add(new csv_SeatingPlan()); […]

MySQL从流中读取失败

我间歇性地面临以下错误。 它通过在mysql服务器设置中使用’skip name resolve’选项来解决。 但是,根据网上发现的许多建议,使用127.0.0.1应该已经解决了这个问题。 但是这也没有帮助你可以建议我一个变通方法或SQL命令,通过它我可以检查’skip name resolve’选项。 Error 1: 0 Authentication to host ‘127.0.0.1’ for user ‘root’ using method ‘mysql_native_password’ failed with message: Reading from the stream has failed. Stack Trace: at MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.AuthenticationFailed(Exception ex) at MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.ReadPacket() at MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.Authenticate(Boolean reset) at MySql.Data.MySqlClient.NativeDriver.Authenticate(String authMethod, Boolean reset) at MySql.Data.MySqlClient.NativeDriver.Open() at MySql.Data.MySqlClient.Driver.Open() at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings) at MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection() at […]

在编码的UI测试中只知道部分窗口标题时查找窗口

我正在编写的用于编码UI测试的应用程序有一个窗口,其中窗口标题的一部分基于为临时文件生成的随机文件名,因此测试只能知道窗口标题的静态部分。 偶尔,当没有其他窗口打开时,测试运行正常。 但是,当其他窗口打开时,这有点问题。 如果其他窗口具有类似的控件,则测试选择哪个窗口是不可预测的。