.net

Custom controls and the VS Toolbox

Hello. I wonder what can be a cause for the non-apparition of custom/user controls in the Visual Studio Toolbar. Thanks. I have a solution with some projects and a lot of custom controls. Normally, these controls should appear in the toolbar automatically after the solution (re)build... (I use VS2005, but this problem appears also in...

Fluent NHibernate table per subclass inheritance mapping

I'm new to NHibernate and Fluent NHibernate. I'm wondering how to properly use Fluent NHibernate with the "table per subclass" mapping strategy. This is an example of what I'm after. More specifically though, I need a way to break the subclass mappings into separate files. Also, when adding records, I need NHibernate to first insert in...

Implementation specific methods on an interface - how can I avoid them?

We have an interface that is passed to the constructor using an IoC container We have multiple classes that implement this interface. The problem is, some (not all) of the implementations need to be cleaned up, preferably using the IDisposable interface. Since not all of the implementations will need the "Dispose" method, do I includ...

Check Network Availablility VB.net

I'm writing an application that will be used in a mobile environment where network connectivity will be up/down regularly. How do I check to see that a specific network is available? ...

Design query for following scenario

I have two tables - Table1: id name number ------------------ 1 x1 123 2 x2 234 ...and Table2: tbl1id title rank -------------------- 1 t1 3 1 t2 2 2 t1 3 1 t3 1 Is there a way I can join them to return result as showing max title based on min rank for given user: id name ...

Finding Network Domains Connected in VB.Net

How do I determine which network domain I am connected to from VB.Net? ...

Should I inherit or subscribe to events?

If I create a Abstract BaseForm for my Windows application, I can use it to do common things when the application's forms are loaded. I can also override the OnLoad method, or I subscribe to the Load event (BaseForm_Load). Which approach is better from the design and performance point of view? ...

Is it a bad idea to use params [] in method signature

Consider the following class public class PlanetKrypton { public static void CallSuperManforHelp(string helpMessage, params object[] kryptonParams) { Console.WriteLine(String.Format(helpMessage,kryptonParams)); } public static void CallSuperManforHelp(string helpMessage ,string sender,string senderZipCode) { Console.Wr...

Template style is not setting some preferences.

I have a style template (below) that does not update some my custom control properties. ... <Style x:Name="KeyboardButton" TargetType="Controls:KeyboardButton"> ... <Setter Property="ArrowDirection" Value="Right" /> <Setter Property="ArrowBeginColor" Value="Red" /> <Setter Property="Template"> ... ArrowBeg...

FTP Upload download using dot net 2.0

Need to upload and download files to and from a FTP server Synchronously using vb.net, any sample code will be helpful ...

Connect to AVAYA CMS database (Informix) using ODBC

I'm trying to use .net to connect to an AVAYA CMS Informix database. I'm using Microsoft Visual Studio 2005 and connecting via a DNS I've created. I can see the tables no problem, but when I try to show the data on an .aspx page, I get the following error: "Parser Error Message: Unrecognized configuration section 'connectionStrings'" and...

Set an Event Handlers From a String

Hi I have a String like this: string myEventName = "myButton_Click"; Then I need to create an EventHandlers for the click of some button, but passing the String as a parameter, the "myButton_Click" method already exists: private void myButton_Click (object sender, RoutedEventArgs e) { } Is this possible, using reflection or other ...

Is there a better way to read one xml value from the database

I'm currently using this code fragment to retrieve the one xml value that will be returned from my scalar query. using (SqlDataReader reader = sqlCommand.ExecuteReader()) { while (reader.Read()) { SqlXml xml = reader.GetSqlXml(0); XmlSchema xmlSchema = XmlSchema.Read(xml.CreateReader(), validationEvent); ...

Change Main in WPF project

Always annoyed me how C# wants to do the startup for you. So now I am trying to make my own main method. It's not working: I have provided this main method: [System.STAThreadAttribute()] [System.Diagnostics.DebuggerNonUserCodeAttribute()] public static void Main() { Model model= new Model(); Controller controller = new Controll...

Are all of the finalizers invoked during a garbage collection?

Let's say i'm trying to allocate 100 bytes, but since I don't have 100 bytes available in my GC heap, a garbage collection is triggered. Also, in my GC heap there's 100mb worth of unreachable objects. To my understanding, once the GC freed 100bytes, he could decide to stop the collection and continue the program's execution. So let's say...

ASP Round function not behaving as expected

I'm rounding up my decimal values to integer values ex: I have 5 numbers whose % sum should end up being 100% but i get 101% my values are 11.11111, 80.55555, 5.55555, 2.77777 and on rounding them i get 11, 81, 6, 3 => 101 In above for example 5.555556 rounds up to 6 (correct value) but is screwing up my total for percentage wh...

linq image saving problems

I have an object that has a property: [Column] public Binary Image { get; set; } When the object is saved the first time every this is OK, but when it is modified I get an exception on SubmitChanges: The data types image and varbinary(max) are incompatible in the equal to operator. What might be the problem here? ...

Installing and Using System.Data.SQLite (An ADO.NET provider)

Hi, I am a newbie in regards to System.Data.SQLite and .NET, so bear with me. I can't seem to get System.Data.SQLite even installed correctly. The self-installer completed and everything seemed to be kosher, but nothing seems to be working. In VC# Express, I tried to create a little sample program(http://pastebin.com/m8f7cec), but it's s...

SqlWebEventProvider w/ windows service

I am trying to raise some custom events to a SqlWebEventProvider from a windows service. Here are the steps I have taken and the results I have seen. I cannot figure this one out. Setup 2 healthMonitoring providers SqlWebEventProvider, and SimpleMailWebEventProvider (both .net 2.0 framework, and sqlwebeventprovider is basically the d...

ASP.Net Persisting Objects

I'm building an ASP.Net website. I have a "cart" class which stores the items in the users cart. I don't want to re query the database every time the page reloads to populate the cart items stored in this object. Is the best way to store/persist instantiated objects by putting them in a session and store the session to a database (we're ...