.net

How to check if a webservice is available using an asynchronous call

Hi, I'm creating a small test application that will run through a few test cases to check the status of various components of our system. The application is created as a .NET Windows Forms application with a few checkboxes that gets checked in for each test case that passes (and not checked if failed). One of the tests is to check the ...

When to include/copy third-party code, rather than reference/link it?

I am working on an .NET library project, containing a bunch of interfaces which can be consumed by a service, which I am also creating. Users of the service will provide implementations of the interfaces from the library, which are then injected into the service application. My library relies on a third-party library, which I will of co...

default parameters and compile time constants

Why is SqlInt32.Null not considered a compile-time constant? Because I cant use it as the default value of a default parameter. ...

Write a function that compares two strings and returns a third string containing only the letters that appear in both

Hi All, I got this homework. And have solved it in following way. I need your comments whether it is a good approach or I need to use any other data sturcture to solve it in better way. public string ReturnCommon(string firstString, string scndString) { StringBuilder newStb = new StringBuilder(); if (firstString...

How to Add a new row to a DATAGRIDVIEW in ASP.NET

How to Add a new row to a DATAGRIDVIEW in ASP.NET....using c# Code ??? ...

RequiredFieldValidator and styling

Hi, Is it possible with the standard .Net field validators to change the style on the textfield, in which the error occures? If I e.g. have a field phonenumber which needs to be filled out, it should create a red border around the textfield on submit, if the field is not filled. Hopefully this can be done with the standard controls so...

Is the 'Implemented Categories' key needed when registering a Managed COM Component?

When registering a managed class for COM Interop by hand, certain registry keys are needed. For example HKEY_CLASSES_ROOT CLSID\[My Cls Id] InprocServer32 (Default) = "mscoree.dll" Assembly = [My assembly name] etc. I've noticed that when VS registers a library for COM Interop, it also adds a key HKEY_CLASSES_R...

Remote Observables in .NET

I encounter this scenario all the time, but have never found anything but home-grown solutions to it: You view a list of orders When you make changes to those orders, they dynamically update on any other clients screens who are looking at the same list, and vice versa I call this idea "Remote observables"... not sure if it has a bett...

What is the difference between uint and System.UInt32?

Is there a difference, or are they just aliases? ...

Is it possible to find POP3 server for any email id using .net or PHP?

Is it possible to find POP3 server address for any given email id (like [email protected])? If yes, please provide some guidance preferably in PHP or .Net. Edit : I get addresses by querying MX record but those are not always the same which people use to fetch their emails. ...

How to forbid calling a method C#

I want to allow calling the method only from the particular methods. Take a look at the code below. private static void TargetMethod() { } private static void ForbiddenMethod() { TargetMethod(); } private static void AllowedMethod() { TargetMethod(); } I need only AllowedMethod could call TargetMethod. H...

Why do "Not all code paths return a value" with a Switch statement inside of an Enum?

I have the following code: public int Method(MyEnum myEnum) { switch (myEnum) { case MyEnum.Value1: return 1; case MyEnum.Value2: return 2; case MyEnum.Value3: return 3; } } public enum MyEnum { Value1, Value2, Value3 } And I get the error: "Not all code paths return a value". I...

How to determine how a dll is ending up in my /bin (.NET)

I've got a solution with two projects, A and B. A references an external dll C.dll from an external /lib folder. When I build B, C.dll is ending up in its /bin folder. B does not reference A or C.dll (but A does reference B). There is no mention (reference) to/of C.dll anywhere in project B, why is it in its /bin? How can I determine...

Problem with ASP.NET 2.0 GridView hidden Columns are shown on Postback

Please Help, I have User Control that contain GridView where i am hiding its Columns on GridView RowCreated event : private void gvGrid_RowCreated(object sender, GridViewRowEventArgs e) { foreach (TableCell objCell in e.Row.Cells) { if (objCell is DataControlFieldHeaderCell) ...

What is the best practice to check if an object is changed?

Hi, I need to know how do you check if an object is changed. Basically I need something like a property that is named TrackChanges, when I set it true once and if any data within this object is "changed", a method on the same object (IsObjectChanged) can return true. Did you ever needed such a thing and how did you solve it? I do not w...

What will be the memory allocation of this C#.NET code.

using System; class ClassOfInts { public int x; public int y; } class Test { ClassOfInts objClassOfInts; string name; public TestMethod(int p, int q, string s) { objClassOfInts=new ClassofInts; objClassOfInts.x=p; objClassOfInts.y=q; name=s; } } class Main { static Ma...

Escape special characters

Hi, My code below seems to be encoding special charcters how do I get it to escape these? str1 += myGridView.Rows[idx].Cells[2].Text + ";"; When i check the grid view html source the table cell text is = 'http://news.google.co.uk/nwshp?ie=UTF-8&hl=en&tab=wn&q=Clifford+Chance&output=rss' But the value for str1 is 'ht...

Built in method to get C-style escaped sequence for a string

Is there a built method in .Net for C-style escaping of strings? For example, I have to convert a string which contains quotes like "hello", and write it as an escaped string \"hello\". Actually, to be more precise: string original = "\"hello\""; should be converted to string what_i_need = "\\\"hello\\\""; I could have probably...

How can I process a 3rd-party key combination when my app is active?

There is a small 3rd-party program in the notification area of the taskbar that uses Ctrl-F11 key combination to do a task. The problem is I am using the same shortcut but mine is shadowed by the other one. Basically, I can not do my thing when the user presses Ctrl-F11 even though my window is the one that is currently active. I thought...

ajax-updatepanel file download problem

I have a gridview inside an update panel which holds the list of uploaded files to application. I want, when a row is selected, on selectedIndexChanged event to return the file to be downloaded here is the code string path = MyFiles.Rows[filesGrid.SelectedIndex]["FilePath"].ToString(); FileStream fl = null; try ...