.net

Code Layout Rules for a Form

While moving some code around for investigation purposes, I came across a little feature of .NET that I was unaware of, which is that the form class must be the first class in a form module for the form designer to work. The following stops the designer from working: public class myClass { } public partial class Form1 : Form { pub...

.NET databound lists

Is there any way around the following? I have a few dropdown lists bound to lookup tables in SQL Server. Some old records imported from a previos version of the system won't open due to data in these fields not matching the current dropdown data. Other than adding the old data to the lookup table (which I don't want to do), is there a ...

Adding custom perfomance counters in ASP.Net for service calls

Hi All, I have to show the time taken for a service call in Perfmon from my ASP.Net application. For this, I have added a stopwatch which starts at the service call start and stops at service call stop. Now I have a custom counter which user AverageTimer32 to log the stopwatch values to Perfmon. My question is, how can I show the service...

Set multiple objects as datasource of a crystal report

I wanna make a crystal report in my c# windows application, the point is I want to use .net objects as my report datasource, I found its sample code as below in internet and use them and it works fine: ArrayList Mainlst = new ArrayList(); Mainlst.Add(new testOBJ { Firstname = "test1", Lastname = "test11" }); Main...

How to develop my own sms Gateway ?

I intend to develop an SMS gateway in c#, but i am doubtful about it's feasibility, because my initial research had shown that an SMS gateway had to cover for protocol differences. So what exactly a gateway had to do, further if i use SMPP, so is it possible to send/receive SMS to/from any number in the world by simply using SMPP ? ...

TFS 2010 Custom Build Activity TF215097 error

Hello, For the Build Process in TFS 2010 I've created a library containing some custom code activities. In the past it all worked fine by adding the library (*.dll) to Source Control and setting the 'Build Controller - Version Control Path to Custom Assemblies' to the path where the library could be found in Source Control. But since ...

Regular expression for dd/mm

Hi Please help me with a regular expression to validate the following format dd/mm This is for validating a Birthday field and the year is not required. Thanks ...

What VS Projecttype for Model and Database?

Hello folks, i've just started a new asp.net project which could increase fastly(a small erp-system for our company). So i thought it would be a good idea to split at least the model from the view/controller(the asp.net project). Because it could be that i need to access some classes and the database from a windows app in future, i dicid...

How to implement a SOAP client in C# (specifically for Windows Mobile)?

I'm really confused about how to create a SOAP client in C# using .NET. I have found this page which looks really promising, but for the life of me I can't find Microsoft.Web.Services2. Also most information I find about SOAP with C#/.NET are about creating web services in ASP.NET and that's not what I want to do. Basically what I want ...

Dynamically display a control depending on bound property using WPF

I've got a property which is a database data type (char, datetime, int, float etc...) and I want to change the control used to enter a value of the selected type. So for text values I want a TextBox and for date values I want a DatePicker. One way I thought about doing it was to have one of each control on my form and set their Visibili...

Problem with reCaptcha and .NET

Hi, I get this error with reCaptcha: 'Input error: response: Required field must not be blank challenge: Required field must not be blank privatekey: Required field must not be blank' I'm sending the data via POST, so I don't understand what is going on. This is the code I use: public static Boolean Check(String challenge, Strin...

How do I use global resources in WPF?

I have a WPF application which I would like to use some static resources in. I have created a Resource Library XAML file which contains a resource. I have also added a string into the Resources of the project through the Properties panel. I assumed I could just use these resources with the binding expression: {StaticResource ResourceN...

Model relationships in ASP.NET MVC

Hi I recently started evaluating ASP.NET MVC. While it is really easy and quick to create Controllers and Views for Models with only primitive properties (like shown in the starter videos from the official page) I didn't find any good way to work with references to complex types. Let's say, I have these Models: public class Customer { ...

Nested/child collections filtering in Entity Framework (ver. 1 or 4)

How to filter nested/child collections of entities when including them in EF? Example: Let's have standard Customer-Orders association. How to load all customers and include only their last three orders in their Orders collection? Is there something like AssociateWith function from L2S for EF? ...

Chart Problem, How to get the legend separated from the Chart?

Hi, I am working with the Chart Control for framework 3.5: http://weblogs.asp.net/scottgu/archive/2008/11/24/new-asp-net-charting-control-lt-asp-chart-runat-quot-server-quot-gt.aspx I cannot put the legend more separated from the chart, this is what I get: Another problem I have, for the orange part (videoconferencia) I pass data only...

Problems connecting to WCF Service via NetNamedPipeBinding

I'm having trouble figuring out how to get a named pipe WCF service to work. The service is in a seperate assembly from the executable. The config looks like this: <system.serviceModel> <bindings> <netNamedPipeBinding> <binding name="NoSecurityIPC"> <security mode="None" /> </binding> </netNa...

Method Calling Public/Private Members or Methods Best Practice - C#.NET

What is the best practice for calling members/fields from a private method and public method? Should the private method always call private fields or should they call the public members? private string _name; public string Name { get {return _name; } set { _name = value; } } public void DoSomething() { _doSomething(); } pri...

NHibernate : recover session after connection lost

I'm using NHibernate with SQL Server 2005 in a WPF client application. If I manually stop the SQL Server service and then restart it the session doesn't automatically reconnect. So far I'm doing this witch seems to work : try { using (ITransaction transaction = this.Session.BeginTransaction()) { // some select here ...

I want a insert query for a temp table

Hi..I am using C#.Net and Sql Server ( Windows Application ). I had created a temporary table. When a button is clicked, temporary table (#tmp_emp_answer) is created. I am having another button called "insert Values" and also 5 textboxes. The values that are entered in the textbox are used and whenever com.ExecuteNonQuery(); line comes, ...

.Net: Best technique to fill a number of combo boxes on the form in windows application?

hi Suppose that you have a win form with 5 combo boxes on it. Some one told me that you must have 5 data table in order to fill them one by one. It does not seem very logical and I think this will create ugly code. How do you fill them with data stored in Database? ...