.net

Approaches for Error Code/Message Management in .NET

Looking for suggestions/best practices on managing error codes and messages in a multi-tiered applications. Specifically things like: Where should error codes be defined? Enum? Class? How are error messages or further details associated with the error codes? resource files? attributes on enum values, etc.? If you have a multi-tier app...

what is Dotnet Module, dynamic keyword and ....

Last day I have been interviewed and the interviewer asked me a) what is dotnet Modules? b) What is the new dynamic keyword and what is it's use(dot net 4.0) c) what is the difference between dynamic keyword and var(dotnet 3.5+) d) What is the difference between Var & Object? Why should we use one over another? Could anyone be kind...

How to prevent a user from changing a file manually?

In a WPF application I use .txt files for holding some information. An application can read and write data from/to .txt file. Everything is OK, but the problem is that, to achieve this purpose, I have to grant writing access rights to these files for a user of an application and so, he/she gets the possibility to edit these files manuall...

How many elements of array are not null ?

An array is defined of assumed elements like I have array like String[] strArray = new String[50];. Now from 50 elements only some elements are assigned and remaining are left null then I want the number of assigned elements. Like here only 30 elements are assigned then I want that figure. ...

How do I convert a type to a string that can be compiled in vb .net?

I need a function that will convert a type to a string, for example: Dim foo as Dictionary(of Dictionary(of Integer, String), Integer) Debug.WriteLine(TypeToString(GetType(foo))) In the debug output, I'd expect to see something equivalent to: Dictionary(of Dictionary(of Integer, String), Integer) ...

Assigning values to the datagridview cell.

How can I assign values of the textbox to the datagridview cell ? ...

How To Implement Fade In/Fade out .NET Compact Framework Forms

Is it possible to implement Fade In & Fade Out effects in .NET Compact Framework forms? We have two panels that needs some smooth transition effects. I checked FlowFx library, but seems to be using it in commercial applications is not allowed. Any other libraries/sample code that helps me? ...

Dynamic Inheritance

hi there I am writing a program and I have some class that doesn't extend any class. I want to know if dynamic inheritance at runtime is possible. I mean if one or more classes can derive from a class at runtime. ...

Can I assign the values to datagridview cells at a time ?

Can I assign the values to datagridview cells at a time like datagridview1[0,0].value = "zero column zero row" datagridview1[1,0].value = "first column zero row" datagridview1[0,1].value = "zero column first row" datagridview1[1,1].value = "first column first row" It gives error Index was out of range. Must be non-negative and less...

Making splitter visible for Split Panel

How do I make a split panels splitter visible to the user, rather than being invisible with only a cursor change on mouse over? ...

After adding a TreeNode to the .NET TreeView, it's IsExpanded property turns false, any idea why?

I have a TreeView control on a form. I am dynamically adding new TreeNodes to it, and I am calling Expand() on them prior to adding them. This causes their IsExpanded property to be true. However immediately after adding it to the TreeView, or to any node on the TreeView, its IsExpanded property turns false and none of the nodes are expa...

Hard-coding Fonts in DotNET

I've run into problems on numerous occasions of users not having one of the Windows Core fonts installed on their machine (Courier New, Comic Sans MS, Arial for example). Whenever I try to construct one of these it throws an error rather than falling back onto a related, or really, any other font. What is the best way to construct a Fon...

itunesmobiledevice.dll - where to find an API?

Hi, I will write a C#.Net application that interacts with the IPhone, I found some old open source code in which the same is done with the ITunes 7.0 and ITunesMobileDevice.dll - but there change to much to the new 9.2 DLL and it don't work. Where I can find more information? ...

when importing data from excel to vb.net file open problem

When importing data from excel to vb.net desktop application, Im having "file is open" error. Excel file is at the remote pc. Excel file must open and I have to reach anytime. How can I handle this problem? ...

How do I change Remote Desktop Services properties of AD users in .NET?

I need to set properties related to Remote Desktop Services on Active Directory users in .NET (i.e., via System.DirectoryServices), but I can't see that these properties are exposed by the API? I know there is a COM interface for this purpose, IADsTSUserEx. Please show me how I can get at these properties in .NET :) Bear in mind that the...

Regular expression to find text not part of a hyperlink

I'm trying to find a single regular expression that I can use to parse a block of HTML to find some specific text, but only if that text is not part of an existing hyperlink. I want to turn the non-links into links, which is easy, but identifying the non-linked ones with a single expression seems more troublesome. In the following exam...

Books for experienced .NET developer learning PHP/MySQL

Hi All, I am an experienced .NET developer (C#/ASP.NET) looking to broaden my skills to the PHP/MySQL arena. I would like get recommendations on books for learning PHP/MySQL that are geared towards someone who is already familiar with object oriented programming and web development. I do realize that there are lots of online material ou...

.NET custom property attribute?

EDIT: I'd better rephrase: How can I shift the GET-implementation of a Class property to a / using a custom attribute? (I've added instantation vars (classname, propertyname) to the attribute, however I'd rather have these automatically fetched ofcourse.) Public Class CustomClass <CustomAttributeClass(ClassName:="CustomClass", Prope...

Access a control's Text property after parent form Dispose()'d?

Long-time joelonsoftware follower, 1st-time stackoverflow poster. I want to know "how safely" I can do the following (C#): Form formDlg = new Form(); TextBox box = new TextBox(); formDlg.Controls.Add( box ); formDlg.ShowDialog(); formDlg.Dispose(); string sUserEntered = box.Text; // After parent Dispose'd! In practice, this (apparent...

Impersonation on Windows 2000 to Windows XP Leaves Connections Open

I'm running on a Windows 2000 Pro SP4 box (off domain) and trying to impersonate a local user on a Windows XP box (on domain). I'm using code very similar to the WindowsImpersonationContextFacade in the question posted here: http://stackoverflow.com/questions/879704/how-can-i-temporarily-impersonate-a-user-to-open-a-file. I am using im...