.net

Find the upper left coordinate of a panel when scrolling

How to find the upper left coordinate of a panel when scrolling? (.net 2) Let's say an example in VB.NET that maintains a textBox in the left border of the custom the panel (myPanel.vb): Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs) MyBase.OnPaint(e) TextBox1.Location = New Point(AutoScrollPo...

Entity Framework (Entities Classes) Serialization

Hi , After reading about Enitity Framework , i have some questions: 1] What is the best way to transfer Entities between tiers ? a] do i must create lighter DTOs for this or i can Effectively serialize the Entitiy and transfer it ? b] if i must create light DTOs,for Efficency, and after i saw the nice usage of Automapper ...

Can a C# expression ever return void?

I have the following method, and I want to know if there is anything that can go in place default(void) below because there is a compiler error that says that void is not valid here: private void applyDefaultsIfNecessary(ApplicationConfiguration configuration) { var defaults = new Dictionary<Predicate<ApplicationConfiguration>, Acti...

is there a good datasource example which binds to json (from a webservice)

Is there a good example (code) for a datasource which binds to json data from a remote webservice? Or is there another smart way to bind json formatted data against for instance a grid control? (either be it web or win forms) I'm asking for the source code, since that way it can be tweaked a bit to the json better ...

Updating the collections of entities with NHibernate the correct way

A simple question regarding how NHibernate works: I have a parent entity that has a collection of other child entities. Those child entities have a reference to the parent entity they belong to. Now I want to implement an Add method to the parent entity that would add a child to it. Should that Add method only add the child to its new pa...

Bulk database rows to message queue for long running operation

At scheduled times (based on business rules), we need anywhere between 10,000 - 200,000 rows from a database to be processed by a long running operation. Each row needs to be processed individually (they don't depend on each other) and it is ok for this to happen asynchronously. The successful completion of the operation must be document...

Sync Framework Version Upgrade Question

For those of you familiar with the Microsoft Sync Framework, this question is for you. It's regarding application versioning. Let's say that I release version 1.0 of my software and a local database sdf file is created from the version 1.0 web service, and life goes on for a while, and the user uses the application and puts data in the l...

Developing Application for Windows 7 : Best practices/things to watch out for

Hi, As someone who will someday be developing applications for use in Windows 7 in .NET, I was wondering what are the best things to do while programming for Windows 7 and also, the things we should be aware of when doing it. ...

vb.net dropdownlist populate

i need to populate my dropdownlist with month and year values to getdate + 1 year. I also want them in text format so "January 2009 and not 1 2009. This is the code i have written to populate the values. how do i convert them to January from 1? Public Sub Load_xxxx(ByRef DDL As System.Web.UI.WebControls.DropDownList) Try ...

Most efficient way to see if a string exists in a collection stored in ASP.Net Session State

I have an ASP.Net app that retrieves a collection of roles for a given user. Each role is a string. There's rarely more than 2-3 roles for any one person. I wanted to store the colelction of roles in Session state to save the time accessing the DB on each request. I basically want to write code that checks if a given string exists in t...

Changing [X] to OK on form in Windows CE .NET 4.2 in .NET application

I have a .NET application that is being targeted to run on Windows Mobile 5 and Windows CE .NET 4.2 and there are some minor differences between how forms display that I'm trying to converge. On the WM device a form will display with an "ok" button in the top right while on CE the same form will show an "X". Is there anyway on CE to ...

Powershell and overriden comparision operators

How can one create an object that when its operators, such as: operator > (Object obj1, Object obj2) operator < (Object obj1, Object obj2) , are overridden PowerShell utilizes these operators? Such that: where-object { $CustomObject -gt 12 } would call: public static bool operator > (Object object1, Object object2) Is it pos...

How to databind Enum value to a Boolean value?

So I have a main form with 3 controls whose Enable property I want to control using an enum. All these controls have a reference to the Data that contains the Enum value Level. enum Level { Red, Yellow, Green } So if it's Red, I want the RedControl to become enabled, if it's yellow, then YellowControl becomes enabled, etc...

When should one care about finishing one method before start next one?

Using C# in WPF, together with LINQ to SQL and LINQ for quering my generic collections, I noticed that sometimes, when I use several methods one after another and results of the first one are needed for next function, I should care about finishing actions of first function before starting next. SomeMethod() { FirstMethod(); NextMeth...

How good is Dotfuscator Community Edition? What is "good enough obfuscator"?

I plan to release one small, low priced utility. Since this is more hobby than business, I planned to use Dotfuscator Community Edition that is shipped with VS2008. How good is it? I could also use definition of "good enough obfuscator" - what features are missing from Dotfuscator Community Edition to make it good enough. Edit: I ...

What should the assembly names be for an application providing both a GUI and command-line interface?

I've written a few desktop applications in .NET that provide both a front-end GUI for normal use as well as a command-line interface for other needs (e.g. extending, scheduling, automating, advanced usage, etc). What is the best practice for naming the two executables, since they are built to the same directory? I've seen or done some of...

How can I add programmability to my application

I'm writing an applicaton that is, at its core, a rules engine. The users want to be able to define custom rules. Some of these will be fairly simple algebraic expressions, many will involve some if-then branching logic, and some will be even more complex. What are my options for doing this? My users are pretty smart, proficient at T-S...

.net Data encryption? Which classes to use?

I am looking into how to encrypt data in .net. After some reading decided on to use AES encryption as it's well establised standard and adoped by almost all organizations. Now i am hunting for how to encrypt data using AES and getting some conflicting results. .Net has classes for AES as well as for Rijndael. If any one has worked wit...

dropdownlist format and then convert

i need a dropdownlist to show current month and year (January 2010) till January 2011, and an additional record of January 2011 +. But I want to save this in the database as 01/01/2010 format. also if the user selects current month then the record should be getdate() to go in database, else for any other month it should be 02/01/2010 (da...

Utility to Convert Legacy VB6 Function Calls to .NET

I am looking for a utility/tool to convert calls to legacy VB6 functions to the .NET equivalent. For example, it would convert this... FormatCurrency(Cart.TotalAmount) Len(Str) UCase(Str) UBound(PaymentsArray) To this... Cart.TotalAmount.ToString("c") Str.Length Str.ToUpper() PaymentsArray.Length - 1 Does anybody know of one, or a...