.net-2.0

MonthCalendar control selection range with EnableVisualStyles?

时间秒杀一切 提交于 2019-12-21 17:56:06
问题 I'm using the MonthCalendar control and want to programmatically select a date range. When I do so the control doesn't paint properly if Application.EnableVisualStyles() has been called. This is a known issue according to MSDN. Using the MonthCalendar with visual styles enabled will cause a selection range for the MonthCalendar control to not paint correctly (from: http://msdn.microsoft.com/en-us/library/system.windows.forms.monthcalendar.aspx) Is there really no fix for this other than not

Compare two datasets in C#

隐身守侯 提交于 2019-12-21 17:51:16
问题 i have two datasets and i need to compare these two datasets such that if ID does not exist in one table then i need to write insert Query else update query. For Ex: Id in One dataset ID in second Dataset 1 1 2 2 3 4 I need to insert ID 3 to second dataset. Here is my code for your reference: if (ds.Tables[0].Rows.Count > 0 || clientDS.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { for (int j = 0; j < clientDS.Tables[0].Rows.Count; j++) { if (ds.Tables[0].Rows

How can I make DataTable enumerable?

£可爱£侵袭症+ 提交于 2019-12-21 17:39:21
问题 I cannot use AsEnumerable() on DataTable, I'm using C# 3 but I'm just targeting 2.0 framework (LINQ capability is courtesy of LINQBridge). Is there any way I can make DataTable enumerable without using Select() ? bool isExisting = (bdsAttachments.DataSource as DataTable).Select().Any(xxx => (string)dr["filename"] == filename); Update: I wanted it to make it look like this: bool isExisting = (bdsAttachments.DataSource as DataTable).AsEnumerable().Any(xxx => (string)dr["filename"] == filename);

calling new SqlConnection() hangs program

你离开我真会死。 提交于 2019-12-21 12:16:31
问题 This one has me stumped. I'm not even trying to connect to a database. When this code gets to the line where I instantiate a new SqlConnection object, it just hangs there, not throwing an exception or anything. I've tried compiling it for 2.0. 3.5 and 4.0, and they all hang. Of course it works on my machine and yours, too. But I'm trying to run this code on a Windows Server 2008 x64 server, and it won't budge. // example.cs using System; using System.Data; using System.Data.SqlClient; public

Is the .NET Framework usable on Win98?

岁酱吖の 提交于 2019-12-21 12:11:02
问题 I need to write a little tool for a customer to be run on Windows 98. Since this is a very small project I'd hope that I could avoid having to go native C++ and use C#. The .net Framework 2.0 download claims to support Windows 98. Are there any caveats or hitches to be aware of when installing or coding? 回答1: There are a few features that Win98 won't support such as form opacity and balloon tooltips. If you use any P/Invoke, you'll have to make sure to support ANSI versions of functions (use

Capturing WndProc message of a certain button click

醉酒当歌 提交于 2019-12-21 06:29:11
问题 I have a cancel button on my form. I want to determine inside the WndProc method that this Cancel button is clicked and write some code for it. This is absolutely necessary because otherwise I'm not able to cancel all other control validation events that are yet to be performed. Please help. .NET - 2.0, WinForms 回答1: This is how you could parse the WndProc message for a left-click on a child control: protected override void WndProc(ref Message m) { // http://msdn.microsoft.com/en-us/library

How to deal with this C# hang invloving SystemEvents.OnUserPreferenceChanged

人走茶凉 提交于 2019-12-21 06:24:17
问题 My WinForm application having a hang problem. What happen is that client sometime leave the application running overnight and when they comeback in morning application is typically in a hang state. This is what I see in dump file on the main thread. What I don't understand is what could make SystemEvents.OnUserPreferenceChanged event to be invoked, although I don't think I am doing anything that is invoking this event. 0024e480 770496f4 System.Threading.WaitHandle.WaitOneNative(Microsoft

Sending data between an asp.net page and a pop up page?

女生的网名这么多〃 提交于 2019-12-21 06:04:49
问题 What are the different ways of communication between asp.net page and a popup page? Query strings etc. Which is most secure? 回答1: You say "communication between" the pop-up and the main ASP.NET page. First, I assume that the pop-up is an ASP.NET page as well so the communication from the main page to the pop-up is no different from the communication from one page to the next in a series of pages. That is, you can store and then use data in the session (if the data is available when the main

.NET 2.0 Setup Project in Visual Studio 2008

坚强是说给别人听的谎言 提交于 2019-12-21 05:32:06
问题 I developed a win forms app targeting .net 2.0. All of this is in Visual Studio 2008 sp1. I did this because I didn't really need 3.0+ features in the app. and I didn't want the clients to have to install a gigantic framework when they could just install a semi-huge one. Well, when I create a setup project for the app, build it, install it, it wants me to install .net 3.5. I am targeting 2.0 in both the windows app and the setup project. Is it possible to make the setup project with only a

Split XML document apart creating multiple output files from repeating elements

你说的曾经没有我的故事 提交于 2019-12-21 05:30:26
问题 I need to take an XML file and create multiple output xml files from the repeating nodes of the input file. The source file "AnimalBatch.xml" looks like this: <?xml version="1.0" encoding="utf-8" ?> <Animals> <Animal id="1001"> <Quantity>One</Quantity> <Adjective>Red</Adjective> <Name>Rooster</Name> </Animal> <Animal id="1002"> <Quantity>Two</Quantity> <Adjective>Stubborn</Adjective> <Name>Donkeys</Name> </Animal> <Animal id="1003"> <Quantity>Three</Quantity> <Color>Blind</Color> <Name>Mice<