.net

How to call a function though Control.BeginInvoke in a signal-slot-like fashion?

I'd like a delegate that calls a function in a different thread when it is invoked. Currently, I'm using the following implementation: delegate void someFunctionDelegate(); //... someFunctionDelegate callBackFunction = someForm.SomeFunction; someForm.Invoke(someFunctionDelegate); However, I'd like a more compact form, combining both ...

How to track changes in many SQL Server databases from .NET application?

Problem: There are a lot of different databases, which is populated by many different applications directly (without any common application layer). Data can be accessed only through SP (by policy) Task: Application needs to track changes in these databases and react in minimal time. Possible solutions: 1) Create trigger for each ta...

Is there a way to add more than one hyperlink in an excel cell in vb.net?

I have an excel sheet where one column consist of comma seprated hyperlinks. However, I am unable to see a way to insert more that one hyperlinks in an excel cell. Is there a workaeround this? ...

Dictionary<string,T>(StringComparer) vs Dictionary<string,T> and storing key.ToUpper : Which one should you prefer?

Disclaimer: Maybe be micro-YAGNI-optimizing but hear me out .. The problem is to implement a case-insensitive lookup table. My old-skool way: While populating the dictionary, upper-case the key before inserting. Upper-case the key when someone gives you a key to lookup. The new way (I learned about it today): Dictionary takes in an IC...

How to databind a DependencyObject is SL4 in code behind ?

I saw that SL4 support binding on DependencyObject rather than FrameworkElement... This works fine in xaml, however I need to do that in code behind. However I don't see any method "SetBinding" in the DependencyObject class, how can I do ? Thanks for your responses ...

Accessing a com object's vtable in c#

EDIT: I am attempting to encapsulate a 3rd party com object in .net classes and at the same time fix a bug with it. I was hoping to replace a method in the com object's vtable with a call to my own method which would provide a bug free implementation of the method. I was trying to test this out on something very basic, but given the a...

Populate ComboBox with line styles .NET

How could I populate a ComboBox (or a ToolStripComboBox like in the image) with line styles .NET? ...

Issue while saving system.decimal values in a dataset

Hello I work on a data intensive module. I have a datacolumn inside a dataset which is bound to a grid. The set datacolumn property is as follows : Datatype : System.Decimal MaxLength : -1 DefaultValue : 0 With this properties i expect whenever i enter a number viz. 11001100011 to be saved as 11001100011.00 However internall...

Is SOA good for us?

Hi there, We are a 5 developer team that are going to create a 150-200 table application. This is supposed to be written in C#, ASP.NET, MS SQL. Is SOA a good architecture for us? If yes, what type of it is better to us? UPDATE: By 150-200 table application, I mean an application that has a database with 15-200 table. This is web bas...

How to add XmlInclude attribute dynamically

I have the following classes [XmlRoot] public class AList { public List<B> ListOfBs {get; set;} } public class B { public string BaseProperty {get; set;} } public class C : B { public string SomeProperty {get; set;} } public class Main { public static void Main(string[] args) { var aList = new AList(); ...

What is the point of Convert.ToDateTime(bool)?

I was doing some type conversion routines last night for a system I am working on. One of the conversions involves turning string values into their DateTime equivalents. While doing this, I noticed that the Convert.ToDateTime() method had an overload which accepted a boolean parameter. First question? Under what circumstances could t...

Explain Entity Framework 4's connection strings

I created an Entity Framework file. My database is called MyDB. My Entity Framework file is MyDB.edmx and I used an existing connection string (MyDBConnectionString) to generate the edmx model. It created two more connection strings: MyDBEntities MyDBContainer What are these for? They look exactly the same and both have the informat...

How to open associated files in the same instance of an application

I want to open files, which are doubleclicked in Explorer, in the same instance of my .Net application, e.g. in a new tab. How can I do this? For now each file starts new instance of my application. Many programs can open files in the same instance, for example, Opera and Notepad++, so there is an easy way for sure. ...

split text to parts

I want to split this text in to 2 parts with C#.Net windows application. C:\Users\Microsoft\Pictures\2010-04-22\003.jpg First part: C:\Users\Microsoft\Pictures\2010-04-22\ Second part: 003.jpg Thanks. ...

Webservice needs to be accessible through website

Hi, I have a .exe program which has an embedded webservice running on port 800. I can access it locally via 127.0.0.1:800 just fine once the program is executed. I need to be able to send the service commands such as: * 127.0.0.1:800/dev * will get a list of devices attached to the program. To my knowledge i need to forward port 800 o...

UdpClient receiving and sending at the same time

Hello, I am maintaining other's code and its using the class UdpClient. The code declares one instance of UdpClient and receives data continuously using the UdpClient.Receive(). When data is received, it is processed in another thread and the UdpClient calls Receive() again. At the same time when the data is processed the same client ...

Accessing Google Spreadsheets with C# using Google Data API fails with Mono

I'm trying to access my Google spreadsheets using the GData API. I have followed the example which looks like: var service = new SpreadsheetsService("myTest"); service.setUserCredentials(username, password); var query = new SpreadsheetQuery(); var feed = service.Query(query); This should return a feed with a list of spreadsheets. Howe...

.NET connecting to oracle problems with the connectionstring

At the moment I'm trying to make a connection to a local server. Connecting via, say, TOAD works fine. When I try to connect using .NET I get ora-12154. Which puzzles me, since I'm using the connectionstring from my TNSNAMES.ora file: XE = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = myPC)(PORT = 1521)) (CONNECT_DATA = ...

Restore Database from SQL Server 2008 to SQL Server 2005

I have created a set of tables (around 20) in SQL Server 2008 and entered around 1000 records to appropriate tables. But the issue is that I want that same tables with all the entered data into SQL Server 2005 (SQLEXPRESS). Obviously it won't work by taking a backup and restore it into SQL Server 2005 as it won't support backward compa...

C# System.Threading.Timer and its state object

I am writing a C# program that uses System.Threading.Timer to timeout on a UDP socket ReceiveAsync call. My program polls a remote device, sending a UDP packet and expecting one in return. I use the timer in one shot mode calling Timer.Change every time I want a new timeout period. For every occurance of a timeout I'd like the timeout...