.net

Windowservice error

Hi i made some changes in windowservice coding side(some class files related to that),,means i did coding to fetch version value from registry,,After stopping the service i copied the exe from the application side which was 72 Kb to installerpath side which was 74 Kb as fresh when installed from Installershield.So here 74kb old one is re...

Show the window form modally on the other form.

I have a window form named form1 and on that I want to show another window form named form2 modally so that user cannot click on anything else until the form2 is closed but user can select only the textbox displayed on form1. ...

Generic method using linq expressions

Hello, i have the next 2 methods public static string[] Method1(CustomObj co) { return new string[] {co.X,co.Y }; } public static string[][] Method2(IQueryable<CustomObj> cos) { string[][] s = new string[cos.Count()][]; int i = 0; foreach (var co in...

Is Environment.TickCount affected by system time adjustments?

I'm curious as to how the .NET BCL property Environment.TickCount is implemented. In particular I'd like to now if it is affected by system time adjustments. My first guess as to how the property was implemented was that it was simply a managed wrapper around the GetTickCount method. However, the documentation for the GetTickCount metho...

C++/CLI performance gain

I started long ago with plain C, then moved to C++ and now I'm facing C++/CLI. As a performance freak, I'm always trying to squeeze the last drop of performance to every line of code. I'm currently in a project that makes sense to be done mostly in VB.Net (simplicity, resource availability, etc.), but has a few points that are very perfo...

.NET: Inject Data into Input-Buffer of Process

Hi * I need to automate an command line application. It asks the user to enter a password. All my approches to send the password via STDIN failed. Now I am trying to do this with an wrapper-programm using .NET. I am starting the application creating a new process, setting the StartInfo-properties and then start the process: Dim app_pa...

DataGRidView with DropDown style Combobox in Editmode

hi I have requirement to implement DropDown style combobox in DataGridView, Where i can Select value from Dropdown even can type new value. Here is the code that i have added for the same: #region dgv_TETV_T_Display_EditingControlShowing private void dgv_TETV_T_Display_EditingControlShowing(object sender, DataGridViewEditingContro...

Create a List of pairs in .net

I need to create a List<> of pairs of my classes. such as: List<Class1, Class2> How would you do it? I can not use the "Pair" datatype because it's in system.web.UI. Would you create a list of arrays? Create a struct of both classes and add them to a list? Is there another way I don't know of and I'm just a noob? Note: I don't want t...

Get domain groups for a specified user and permissions for a specified file using .Net

I want to return a list of group memberships for a specific domain user. Something like... string[] UserGroups(string domain, string domainUserName) { // query domain info // return a list of accounts the user is a member of } Also, I want to be able to see which domain accounts/groups have access to a specified file/folder. ...

COM - .NET Interop - Winform from COM client

hi there, I have a .NET application containing a WinForm. This WinForm contains an unmanaged ActiveX control and a few other controls. This application works fine in standalone mode. Now we want to publish some kind of interface so this Winform can be used from unmanaged C++/MFC applications using Interop functionality. The client appli...

Why do some .Net Exceptions end with newline

I have a ListView that displays error to the user. Part of it also includes the exception message. The error is also written to a log file. Now I have noticed that some exception messages end with a newline. e.g. File.Move can return the message (English .Net 3.5 SP1) "Cannot create a file when that file already exists.\r\n". The newli...

.Net Regex to parse Excel header / footer strings

I am trying to create a .Net Regex that will separate an Excel header data string into its component parts. The following example shows the format of the raw data string I need to parse: &LLeft-side text&CCenter text&RRight-side text The tags &L, &C and &R respectively demark the left, center and right sections of the header data. So,...

Anatomy of a Postback

How do I determine the Params sent by a POST method? If I have a button, and that button is clicked, what is sent to the server? ...

Determine if internet connection is available

Hi, I know that I am not the first to ask the question: How do I find out if my application is online or not? I found this post: StackOverflow. I want to do it with C# and .NET 3.5. The recommendation is to ping the resource regularly. I am not very happy with that advice. I would rather detect a network change and THEN ping my service...

Subset of service operations on the client in WCF

If I have a service contract containing 2 operations, is it possible to have a client side service contract (.NET interface) that only has one of those operations? More generally, is it possible to only use a subset of service operations on the client and even to not have to have generated code for other operations (and their correspondi...

In 3 minutes, What is Reflection?

Many .Net interview question lists (including the good ones) contain the question: "What is Reflection?". I was recently asked to answer this in the context of a 5 question, technical test designed to be completed in 15 minutes on a sheet of blank paper handed to me in a cafeteria. My answer went along the lines of "Reflection allows you...

Fixing .NET code generation of properties for user controls

I have a property of type IEnumerable<SomeClassIWrote> in a user control. When I use this control in a GUI, the .Designer.cs file contains the line: theObject.TheProperty = new SomeClassIWrote[0]; Which for some reason causes a compiler warning: Object of type 'SomeClassIWrote[]' cannot be converted to type 'System.Collections.Generi...

Can string formatting be used in text shown with DebuggerDisplay?

I want to apply the DebuggerDisplayAttribute to include an memory address value. Is there a way to have it displayed in hexadecimal? [DebuggerDisplay("Foo: Address value is {Address}")] class Foo { System.IntPtr m_Address = new System.IntPtr(43981); // Sample value System.IntPtr Address { get { return m_Address;...

Filemaker .Net Driver

I am not familiar with Filemaker, but I have inherited a Filemaker (I think v3) database. Is there an ADO.net or odbc driver I can use to extract data? ...

.NET: How to efficiently check for uniqueness in a List<string> of 50,000 items?

In some library code, I have a List that can contain 50,000 items or more. Callers of the library can invoke methods that result in strings being added to the list. How do I efficiently check for uniqueness of the strings being added? Currently, just before adding a string, I scan the entire list and compare each string to the to-be...