.net

Is it possible to make a date datatype accept 13 as a month and 30 for all months?

I am in Ethiopia and we have 13 months. 12 of them with 30 days each and 13th month with 5 or 6 days. I want to sort my data by date using the BindingSource sort method. But to do that, I need to set my date field a date data type. When I set the DataType to date, I can't enter some values like 13 for the month value and 30 for day value...

Programmatically getting SQL Cluster Virtual Name

I have written a Windows service to collect information from all of our SQL servers. The service gets installed onto each server, and utilizing WMI and SMO, inserts relevant system information back to a central database. In order to get the SQL information, I use the following c# code: List<Server> sqlServers = new List<Server...

Specifying what network interface an UDP multicast should go to in .NET

On a computer with both an active Wireless Card and a LAN-Port with a crossover cable hooked up to another machine running the same application, we need to send a UDP multicast over the LAN wire to the other computer. Using C# Sockets, Windows seems to try to route the message over the WLAN adapter every time. Is there a way to specify ...

c# event handling between two forms

I have two forms and I am trying to capture an event generated from frmEventGenerate.cs in frmEventReceive.cs. In this example I can receive the event from frmEventGenerate.cs but not sure how I can catch this in frmEventReceive.cs? frmEventReceive.cs is my startup form which creates frmEventGenerate.cs. Can someone point me in th...

NHibernate Mapping (Attributes) : KeyProperty not persisted

Hi, In my current project, Workflows have comments. Please have a look at the following code. [CompositeId] [KeyProperty(1, Column = "datum", Name = "Date", TypeType = typeof(DateTime))] [KeyManyToOne(1, Column = "workflow_id", Name = "Workflow", ClassType = typeof(Workflow))] public virtual IWorkflow Workflow { get; set; } ...

How do set a breakpoint on a method within the .net framework

I wish to set a breakpoint on the System.Threading.SynchronizationContext::SetSynchronizationContext static method so I can find out when the synchronization context is being set. However I can’t find how to set a breakpoint in a method I don’t have the source code to. (This should be easy!, but when I try to set the breakpoint on a...

Excel formatting cells

I have a sheet which has date with extra space at end. And i want to remove them so that i can format them as date and sort excel sheet. I used macros available online for ex: Sub TrimColumnA() Dim rng As Range On Error Resume Next ''#if entire column is blank, exit sub Set rng = Intersect(Range("B1").EntireColumn, ActiveSheet.Use...

How to close the input stream of an IronPython engine executing a script?

I am creating an IronPython engine more or less like so: var engine = IronPython.Hosting.Python.CreateEngine(); var scope = engine.CreateScope(); // my implementation of System.IO.Stream var stream = new ScriptOutputStream(engine); engine.Runtime.IO.SetOutput(stream, Encoding.UTF8); engine.Runtime.IO.SetErrorOutput(stre...

Visual Studio 2008 custom class item template, $safeprojectname$ not reconciling

Just setting up some quick class and object item templates and all is working great so far, but one thing I'm stuck on is the $safeprojectname$ template parameter. I've added this as part of the namespace portion and the $registeredorganization$ is working fine namespace $registeredorganization$.$safeprojectname$ { public class $sa...

Apps only works when Visual Studio is installed?

I have a DLL put together which is used by a number of applications. They compile and run just fine on my development machine. But if I try to deploy them, I just get the standard "your application has crashed" message from Windows when I try to run them. I figured, since they're .NET, I could install Visual Studio and see what the excep...

Excel get_Range missing when interop assembly is embedded in .NET 4.0

I build an assembly referencing a COM interop DLL. If I embed the COM interop types by setting Embed Interop Types to True in the Reference's properties (VS2010), at run-time an error occurs "object does not contain a definition for get_Range". If COM interop types are not embedded then no error occurs. Does anyone know why a particul...

String was not recognized as a valid DateTime " format dd/MM/yyyy"

I am trying to convert my string formated value to date type with format dd/MM/yyyy. this.Text="22/11/2009"; DateTime date = DateTime.Parse(this.Text); What is the problem ? It has a second override which asks for IFormatProvider. What is this ? DO I need to pass this also. If Yes how to use it for this case Edit What is t...

.NET App Hangs in Release mode only, sometimes ... :-(

In our program, you can select a document type from a list. You then click OK, or double-click the selected item, and a new document is created and shown. Now the problem is that SOMETIMES, in release mode only, when you double-click an item, the app hangs. You can still move windows, and all is repainted fine, but there's just no respo...

Manually Add a Resource File (Visual Studio)

I have a solution in VB.NET (VS 2005) In this solution I have a custom control, that inherits from a abstract class. Now, as VS is VS, it doesn't want to display the control in designer, because its parent is abstract. Now, I want to add a picturebox with an image (bmp or ico) to this control. Normally I've done this opening the desi...

access response from .NET webservice in callback function on HTML page

Hi All, I am trying to call a .net webservice from HTML page. This HTML page will be hosted on a different server. I using the following html code for this. The webservice code is below HTML code. This code runs just fine in IE and runs fine in Mozilla when debugging with venkman. But fails in normal execution in Firefox. I dont get any...

Draw border around a Control on Button_Click

When a user clicks my Validate Button (in my C#, WinForm, .net 3.5 app) I would like to draw a border around a certain control if it is empty. Say a textbox that is named tbxLastName I thought I needed to do something like this --> ControlPaint.DrawBorder(Graphics.FromHwnd(this.Handle), tbxLastName.ClientRectangle, Color.Firebrick...

.NET (C#) events - custom EventArgs question

I have a number of C# custom events that are associated with items being selected in a tree and then a context menu being used to trigger some action on the selected items. I started creating a separate EventArgs-based class for each custom event, to package the necessary data for the event. In hind-sight though, I realize that most ...

nHibernate safe delete

Is there any way to check if it is safe to delete record from table ? for example : daoStudent.Delete(id); doesn't throw exception if it has any child records , but I would like it to. I could take other actions like making student inactive. ...

How to map null values with AutoMapper for an specific mapping?

As the title says... I found this solution http://stackoverflow.com/questions/1526813/automapper-setting-destination-string-to-null-actually-makes-it-string-empty but It uses the Initialize method so all the mappings behavior would change along the app : O And I just need do it for a specific mapping. Thanks in advance. ...

CLR assembly will not load in 64 bit SQL Server 2005

We use an assembly with some user defined functions in our installation of SQL Server 2005 (32 bit). We deploy this to production with a script like this: CREATE ASSEMBLY [Ourfunctions] AUTHORIZATION [dbo] FROM 0x4D5A9000...000 WITH PERMISSION_SET = SAFE GO CREATE FUNCTION [dbo].[GLOBAL_FormatString](@input [nvarchar](4000)) RETURNS [nv...