.net-3.5

.NET 2.0 Setup Project in Visual Studio 2008

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, instal...

Security error in ASP NET shared account

Hi, These lines cause a security exception in a godaddy account. Any suggestions how to rewrite to get this to work? File.Delete(PropsFileName); // Clean up TextWriter tw = new StreamWriter(PropsFileName); // Create & open the file tw.WriteLine(DateTime.Now); // Write the date for reference tw.WriteLine(TokenLine); // Write t...

Nested enums with System.Reflection.Emit

I want to create a class with a nested enum. public class Foo { public enum Views { } } However System.Reflection.Emit.TypeBuilder class has no DefineNestedEnum only DefinedNestedType. ModuleBuilder.DefineEnum exists that let's me create an enum but I find no way to make it nested. Can I create an enum without faking it ...

.NET 3.5 vs. .NET 3.0

I want to write a program in WPF but not sure should I target .net35 or .net30. The advantages of .net35 are obvious. But still, I see one major advantage of .net30 -- it's built into Vista, so, the people using Windows Vista will not have to download and install the framework. Do you think the advantages of .net35 outweigh the hassle o...

DataTable Select() with Guids

I am trying to boild my treeview at runtime from a DataTable that is returned from a LINQ query. The Fields returned are: NAME = CaseNoteID | ContactDate | ParentNote TYPE = Guid | DateTime | Guid The ParentNote field matches a entry in the CaseNoteID column. The Select(filter) is giving me a runtime error of Cannot find col...

Adding a collection of a subclass with AddRange

If I have these two classes: class A {} class B : A {} and I make a List<A> but I want to add a List<B> to it by calling List<A>.AddRange(List<B>) but the compiler refuses: Argument '1': cannot convert from 'System.Collections.Generic.List<A>' to 'System.Collections.Generic.IEnumerable<B> which I completely understand because IEnum...

ReportViewer 2008 switch to different page sizes

My deployed application uses ReportViewer (CLR 3.5) to print locally reports. Recently users noticed problem with printing. I've investigated that and turned out that in some PC reportViewer set page format to Letter (instead A4) that's why printouts are cut. Note all user use same network-deployed version with same ReportViewer dlls. ...

Data Annotations in VB.NET

In learning the Silverlight technologies, I came across Mike Taulty's tutorial videos on using Silverlight3.0 DataForms (Click Here to check it out), and was particularly interested in the way he used data annotations in C# to do some data validation. I have found a lot of samples on using annotations this way, but all in c# - very li...

How to order a IEnumerable<T> of anonymous type?

See the code below, I don't know why my ordering is not working, any ideas? var orderSample = new { ProductName = "", Qty = 0, UserFullName = "" }; var ordersList = (new[] { orderSample }).ToList(); //loop thru another collection and fill ordersList by adding an order at a time ordersList.Add(new { ProductName = "Product1", Qty = 5, Us...

Inserting image over 3mb via linq-to-sql

New day, new problem :-) Code: Client Side: void abw_Closed(object sender, EventArgs e) { DbServiceClient sc = new DbServiceClient(); abw = (AddBlobWindow)sender; fi = ((AddBlobWindow)sender).fi; if ((bool)((AddBlobWindow)sender).DialogResult) { blob = new Blob(); binBlob = new Binary(); bina...

Why is POST data lost when submitting from a Custom 404 page in IIS 6.0?

I built a Custom 404 CMS system in .NET 3.5, and while posting data works locally in IIS 5.1 and 6.0, it does not work on the production IIS 6.0 server. I compared the IIS 6.0 site settings item by item, and they are nearly identical, with the only differences not mattering. I verified that the form is POST-ing to "http://domain/folder...

How do I update an object's foreign key value with LINQ to Entities?

Suppose I have these tables: Fruits - FruitID INT PK - FruitName NVARCHAR(30) - FruitStatusID INT FK: Statuses Statuses - StatusID INT PK - StatusName NVARCHAR(30) How do I update both the Fruit's name and its status in the database in these situations?: Update a piece of Fruit that came from a previous L2E c...

Disabling checkbox selections in VB .NET 2008 Winform Listview

How do you disable additional checkbox selections/deselections without sacrificing the functionality of the ListView? I know you can call: ListView.Enabled = False, but that also disables any scrolling within it. For example: I have a timer that starts a backup based on the Listview items that are checked. After a certain time, I don...

.NET Entity Framework

Is it bad practice to use the code-gen'ed objects from Entity Framework as business objects? Or is it better to write a secondary wrapper around Entity Framework objects that I would then pass between layers? For example, write my own POCO Person that accepts one of my code-gen'ed Entity Framework object EFPerson to initialize the POCO ...

How do I update a SQL row given an ID with LINQ to SQL?

Given this schema: Fruits - FruitID INT PK - FruitName NVARCHAR(30) - FruitStatusID INT NULL FK: Statuses Statuses - StatusID INT PK - StatusName NVARCHAR(30) If I have a FruitID in hand (just an int, not a Fruit object), how do I update the FruitName and null out FruitStatusID without loading the Fruit object ...

Dynamic LINQ context

I'm trying to figure out how to create a dynamic context, and what I mean by that is I have two databases: one for testing, and one for production. Depending on where my website is hosted, I want my context to be pointing at one of the two. So, in my web.config I have: <add name="Testing_ChannelsEntities" connectionString="removed for b...

The underlying connection was closed: An unexpected error occurred on a receive.

When I try my program on my win2k8 machine it runs fine but on win 2k3 it gives me this error that error message here's the code that' generating the error WebClient wc = new WebClient(); wc.DownloadFile("ftp://ftp.website.com/sample.txt"); have search the web for hours, couldn't find any solution. please help thanks ...

How to change data display in a TextBox from a DropDownList selection?

Hi guys as the subject i posted. I really need to know, how to get result from DDL that can automatically changes the display in the TextBox. Our each item has got more than one size and sometimes the price will be different when you click on a different size. How can I implement this function? Any help, I would appreciated. Here is my...

Universal method with lambda’s criteria at Business Objects Collection

I have abstract class for each Business Object in my app (BO) Also have parent (generic) collection to store all BOs (named BOC - Business Object Collection) What I would like to archive is created universal method iniside BOC similar to: public T GetBusinessObject (lambda_criteria) So I could call this method similar to: Employe...

linq query to join two tables and get the count from one table values from the other

I have two tables Customers, Orders Customers CustomerID FName LName Orders OrderId CustomerID OrderDate I want to make a linq statement that can join these two tables and get FName, LName, Count of orders for each customer ...