.net

What is SocketOptionName.ReuseAddress used for?

I used to think that using SocketOptionName.ReuseAddress, I can reuse a port that is in TIME_WAIT state. But I tried to experiment with it and it seems it has no effect. If I check sockets using netstat, and it shows the socket is in TIME_WAIT state and I immediately run the client again, I get the exception: Only one usage of each ...

an attribute argument must be a constant expression

Hi, Is there any workaround for the following issure "an attribute argument must be a constant expression" I want to use decimals in the attribute paramter. Advance thanks. Thanks, Jio ...

Cannot create a new VS data connection in Server Explorer

I have a local instance of SQL Server 2008 express edition running on my development PC. I'm trying to create a new data connection through Visual Studio Server Explorer. The steps are the following: Right click the "Data Connections" node => Choose Data Source. I select "Microsoft SQL Server" as the data source. The "Add Connection" ...

Release resources in .Net C#

Hi, I'm new to C# and .NET, ,and have been reading around about it. I need to know why and when do I need to release resources? Doesn't the garbage collector take care of everything? When do I need to implement IDisposable, and how is it different from destructor in C++? Also, if my program is rather small i.e. a screensaver, do I nee...

SHCreateStreamOnFileEx linker error

Hi, I am getting linker error while working on SHCreateStreamOnFileEx. Please help me to find out the problem. IStream* replace::GetStream() { LPCWSTR pszFile=L"D:\\Test\\output.txt"; IStream* dataStream = NULL; if (dataStream == NULL) { SHCreateStreamOnFileEx(pszFile, STGM_READ|STGM_SHARE_DENY_NONE|STGM_DELETEONRELEASE, ...

Silverlight and Search Engines

Hi, I have recently started learning SilverLight (and Web developement in general) and have been advised by a friend that SilverLight isn't Search engine friendly (because Silverlight isn't HTML). Is there any way of getting around this and getting my site onto the Search engine lists (without paying)? (Any advise on getting my site on ...

WCF: Manually configuring Binding and Endpoint causes SerciveChannel Faulted State

Hi there, I've created a ComVisible assembly to be used in a classic-asp application. The assembly should act as a wcf client and connect to a wcf service host (inside a windows service) on the same machine using named pipes. The wcf service host works fine with other clients, so the problem must be within this assembly. In order to ge...

Select value in designer for a Type property

I have a UserControl that exposes a System.Type property. I want to make it settable at design time, like the BindingSource's DataSource property. Ultimately, I would like the designer code to generate this: this.EntityType = typeof(Company.Product.Class); Where the class selection would come from the project's registered Data Sources...

Forcing Basic Authentication in WebRequest

I am integrating web service that will use an HTTP-POST to request and retrieve data. The remote server requires basic authentication as per RFC 2617 My attempts to authenticate are failing. It fails in that, even though I attach a 'NetworkCredential' object to the 'Credentials' property of a 'HttpWebRequest' object, no authenticatio...

.Net MVC UserControl - RenderPartial or EditorFor

Hi I have a View that contains a usercontrol. The usercontrol is rendered using: <% Html.RenderPartial("GeneralStuff", Model.General, ViewData); %> My problem is that the usercontrol renders nicely with values from the model but when I post values edited in the usercontrol they are not mapped back to Model.General. I know I can find ...

Color of OverFlowButton in WPF toolbar

There was a problem. When I change the background color of WPF toolbar Overflow Button in the right corner does not change color. How to fix it? Example: ...

Exception handling policy in libraries

When building a .NET library, what's your exception handling policy? In specific, what's your policy about handling exceptions inside library calls and exposing them to calling code? For example, Would you treat a library function as any other, thus letting all exceptions it can't handle flow out of it as-is? Would you create a custom...

Assembly.LoadFrom() permissioning in .NET 4.0

I am having trouble with security while migrating an application from .NET 3.5 to 4.0. I have an application that starts successfully from a network share I've mapped to z: - Z:\MyApp\App.exe. This application makes use of add-ins, and is sometimes asked to load assemblies from a seperate location on the Intranet - y:\MyLib\Lib.dll...

How do I determine the dimensions of a .NET listview at runtime?

I have a form with a split container and each panel has a list view and some buttons. I wanted to make sure that the header and at least two rows are visible in a listview. I originally determined the values for panel1MinSize & panel2MinSize by fine tuning the values visually (on my XP development machine). This approach was fine until I...

Ternary operators in C#

With the ternary operator, it is possible to do something like the following (assuming Func1() and Func2() return an int: int x = (x == y) ? Func1() : Func2(); However, is there any way to do the same thing, without returning a value? For example, something like (assuming Func1() and Func2() return void): (x == y) ? Func1() : Func2(...

Java web service serialization

I use Java service in .NET application. I can see and use enums which is used in web methods as parametrs but can't see enums which is not used in any web wethod. Why? ...

Rich text box doesnt appear in toolbox

i select choose item from toolbox then whitch tab select to select rich text box to put in toolbox so i can put it in my form generaly how can i use rich text box in form ...

[C#] Change class definition on runtime

Hey guys, I was wondering if there is a way for me to change the properties a class has (add/remove properties) on runtime.. Is this possible? ...

How to use WinHelp (.hlp) using .NET Help API?

I am saddled with WinHelp format (.hlp) files and need to invoke them from a .NET 3.5 DLL. I can get the file to launch but am unable to get either TopicId or Topic to work. The file always opens to the "Getting Started" topic. ...

How can i get a file from remote machine?

How can i get a file from remote computer? i know remote computer ip and 51124 port is open. i need this algorith:(this is a Windows Application visual studio 2008) 1) Connect 192.xxx.x.xxx ip via 51124 port 2) filename:123456 (i want to search it on remote machine) 3) Get File 4) Save C:\ 51124 port is open. can i access and can i se...