.net-3.5

ASP.Net Forms "type exists in both dll1 and dll2" error in Debug mode but not Release mode

In a website project targeted for the .Net Framework 3.5 I occasionally get an error like the following: The type 'ASP._myetc_master' exists in both 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\site\3a65eca7\73f2d86b\App_Web_myetc.master.cdcab7d2.iefhoqis.dll' and 'c:\Windows\Microsoft.NET\Framework\v4.0.303...

How to delete Excel.Name object?

I have a bunch of Excel.Name objects under Workbook.Names collection which contain invalid references. In other words, when I evaluate the Excel.Name.RefersTo property, I get a value back beginning with "=#REF...". I tried to run the following code but it seems to have no effect in removing the names: var ranges = myWorkBook.Names; for...

.NET DateTimePicker

I’m currently trying to use this control to provide a means of selecting a date and time from a dialog box. However, I can’t seem to work out how to allow selection of a date AND time (format seems to allow short, long, custom and time). Please could someone point me to the relevant property for this? ...

Is it possible to change the color of particular cell in a gridview?

Iam displaying the days of a month in a grid. If the first day of the month starts with Wednesday then I need to gray out the cells of Monday and Tuesday for the first week. Is it possible to change the color of particular cell in a gridview? Iam not using rowdatabound Is there any alternative apart from rowdatabound??? pls help... than...

Linq-to-entities: Easy to find max value in SQL, but difficult in LINQ?

I've started using Linq-to-entities with .NET 3.5, and I've come across a scenario that I can do real easy in SQL, but I'm having great difficulty with linq. I have a table in a SQL database with three fields, for purposes of this example I'll call them foo, bar, and foo_index and populate them like so: Blockquote foo | b...

cloning tabpage with user control inside of it?

There is a form with a tab control, which has a tab page element. This application is designed in such a way that it is if you drag and drop a chart control (which are listed as icons in a sidebar) the chart gets populated with data, and shows a graph. We have a button which should make a clone of that tabpage and show itself in another...

Serializing Object - Replacing Values

Hey Everyone, I've got a collection of around 20,000 objects that need to get persisted to my database. Now, instead of doing 20,000 insert statements, I want to pass all the records in using an XML parameter. As far as serializing the object and passing it into the procedure goes, I'm all set. However, I'm wondering if anyone has an...

Using named pipes asynchronously with StreamWriter

I am trying to send a string over a named pipe using StreamWriter, but StreamWriter class only offers synchronous operations. I can use BeginWrite method of the NamedPipeServerStream class, but I wonder why there are no writer classes that would allow asynchronous operations. Am I missing something obvious? ...

Extraneous wcf body xml namespace declarations

I generated a set of web service proxy objects with the .Net 3.5 svcutil.exe tool. The soap body element has 2 extraneous xml namespace alias declarations. Specifically schema and schema instance namespaces ( http://www.w3.org/2001/XMLSchema, http://www.w3.org/2001/XMLSchema-instance ). For other reasons, the service I'm interacting wit...

How to change the report's "document map" root label?

Technologies: .net 3.5, Visual Studio 2010, Report Viewer Control version 10, c# I am using adhoc reports in my winform application, now here is the problem: When my report is rendered in the viewer, the document map displays the report file name as the the root node of the document map. I need to display a more user-friendly descripti...

Difference between Open and Create on DocumentFormat.OpenXml.Packaging.WordprocessingDocument

The docs for both methods read virtually identical to me. I have a template (.DOTX) which I want to open and make changes to, saving as .DOCX. What's the right approach? And, in fact, how do I save the document? I see no Save method... ...

How can I tell when a collection has been edited?

I have a public property called Items, It's a List. I want to tell when it's been altered. How can I do this? For example, if Items.Add is called, I want to be able to then call UpdateInnerList. How can I do this? ...

Refreshing Windows program when other users make changes?

Scenario: 4 users launch separate instances of the same client program (Winforms) that is connected to a database based To-Do list. The first user selects the 3rd To-Do list item. How do I update/refresh the other 3 users screens to reflect that item #3 is no longer available? My thought was a table that contains the last update d...

Cannot get databinding to work

I am having difficulty binding to a property on my object. This is my property: private int? Tid; private int? innerTenantID { get { return Tid; } set { Tid = value; innerTenant = (value.HasValue)? Tenant.GetTenantByID(value.Value) : null; } } And this is my attempt to ...

determine List type in C#

Is there any way using reflection in C# 3.5 to determine if type of an object List<MyObject>? For example here: Type type = customerList.GetType(); //what should I do with type here to determine if customerList is List<Customer> ? Thanks. ...

listView doesnt show content

Hello Im working with ListView in C#.NET. Im using code similar to this: string[] row1 = { "s1", "s2", "s3" }; listView1.Items.Add("Column1Text").SubItems.AddRange(row1); However I can't see the content, only the name of the column. Why is this? ...

NHibernate query returns changes not yet persisted to database

Hi, The following unit test fails, I make changes to an object that I've retrieved and then in the same session I make a query which appears to take into account the uncommited changes I've made to the object. How can I get NHibernate to ignore any uncommited changes and only query the database? [Test] public void Test() { // Arra...

Downloading File from remote server using php script without fopen

Hi, Scenario : I have a c# .net web page. I want the user to be able to download a file placed on a remote server from a link on my page. However while downloading there should be minimum load on my server. Hence i tried creating a HttpWebRequest instance, passed the download.php path e.g. HttpWebRequest myHttpWebRequest = (HttpWebRe...

Creating an object that's defined in a dll that I don't have a reference to

I have the full path to a dll, but not a reference, where I need to instantiate an object that implements an interface that I've defined. I do have control over the other dll, so I am able to do things like stick a static function in the dll that returns the object I need. I'm just not sure how to call that function, or even if I'm appro...

Parsing command-line options in C#

I've seen people write custom classes to more easily handle command line options in various languages. I wondered if .NET (3.5 or lower) has anything built in so that you don't have to custom-parse things like: myapp.exe file=text.txt ...