.net

Why ParameterInfo::GetXXXCustomModifiers does not returns IsLong if the parameter is ByRef?

Given a ParameterInfo p from this: void foo(int modopt(IsLong) n); p.GetOptionalCustomModifiers() returns a System.Runtime.CompilerServices.IsLong; however, if the method signature happens to be: void foo(out int modopt(IsLong) n); It does not. Is there a work around for this? ...

How do I send keystrokes to a serial port in vb.net?

I am trying to send a ctrl-x keystroke to COM2 and I ahve to code to open the port and read and write but when I tried to send Chr(Keys.ControlKey + Keys.X) it did not work. any ideas? ...

How can I locate .NET Library property/function that return a particular type?

Occasionally I will know that there is a .NET Framework function that returns a particular type of object, but I can't recall the property or function name. It would be really nice to be able to somehow scan the Framework or other DLL for functions that return a particular type of object. (For example, it would have helped when I asked...

Is it possible to make a persistent connection between a Python web service and a .Net WCF Client?

I have a .Net 3.5 SOAP client written in C# using the WCF. It's expecting basicHTTPBinding and a persistent connection with HTTP/1.1. I'm trying to create a Python 2.6 application that will act as a web-service for the client. My problem is that the client keeps closing the connection and opening a new one for every command to the web...

size of structures in .NET

My problem is very simple. My problem is to send a structure between a program in C to a C# program. I made a struct in C#: public struct NetPoint { public float lat; // 4 bytes public float lon; // 4 bytes public int alt; // 4 bytes public long time; // 8 bytes } Total size of the struct must be 20 bytes. When I do...

SQL Server - CAST AND DIVIDE

DECLARE @table table(XYZ VARCHAR(8) , id int) INSERT INTO @table SELECT '4000', 1 UNION ALL SELECT '3.123', 2 UNION ALL SELECT '7.0', 3 UNION ALL SELECT '80000', 4 UNION ALL SELECT NULL, 5 Query: SELECT CASE WHEN PATINDEX('^[0-9]{1,5}[\.][0-9]{1,3}$', XYZ) = 0 THEN XYZ WHEN PATINDEX('^[0-9]{1,8}$',XYZ) = 0 THEN CAS...

Comparing two List<MyClass> in C#

I have a class called MyClass This class inherits IEquatable and implements equals the way I need it to. (Meaning: when I compare two MyClass tyupe objects individually in code, it works) I then create two List: var ListA = new List<MyClass>(); var ListB = new List<MyClass>(); // Add distinct objects that are equal to one another t...

Clearing C#'s WebBrowser control's cookies for all sites WITHOUT clearing for IE itself

EDIT: As far as I know, there is no solution to this problem, making it yet another testament to the fact that one should not use C#'s WebBrowser. We ended up with a warning sign at the start of our program, notifying the user that cookies will be cleared for IE. The short version of what I'm trying to do is in the title. Here's the lon...

Ellipse Drawing WPF Animation

I am developing a control that is a rectangle area and will draw an ellipse in the rectangle area when a trigger occurs. This control will be able to host other controls like, textbox's, buttons, etc. so the circle will be drawn around them when triggered. I want the circle being drawn as an animation like you were circling the inner c...

Form.Show() is not showing it's child controls

I have a form, frmPleaseWait, that has a MarqueeProgressBar and a Label that I want to use when the UI is loading the data in a poorly structured app we have. The problem is that frmPleaseWait.Show() shows the form but not the controls in it. It is just a white rectangle. Now frmPleaseWait.ShowDialog() shows the child controls but d...

Error launching application after ClickOnce deployment - "An application for this deployment is already installed with a different application identity"

As part of my continuous integration build the application is deployed as a ClickOnce application. This works great the first time, but when I try the launch the app after an update has been deployed I get the following error. An application for this deployment is already installed with a different application identity. If I ru...

Display html text in Windows Forms

I have a some of html strings that my application generates. Each html 'snippet' is stored as a collection of strings. I need to display some of these according to the user query. What is the usual way to display html stylized texts in Windows Forms. ...

How do I specify a keys password with MSBuild for the purpose of using Hudson?

We have just setup our hudson server to build .NET projects which seems to be working fine, however for projects that require a password when signing the assemblies I can not figure out how to tell hudson what the password is? For us the password is asked the first time a developer checks out the source code and they open with visual st...

How do I specify a project dependency with Hudson?

We have common library projects shared amongst many projects that are required to be checked out into a "Libraries" folder which a developer needs to checkout prior to opening the main project in visual studio. How I tell hudson that there is this dependency? I figured one thing I could do is setup a custom workspace and specify the lo...

XMLPoke a referenced assembly's appconfig value?

I have an assembly built that uses appSettings in the app.config...pretty straight forward. however, I'm referencing this assembly in a web service, and that web service contains the nAnt build file for this service plus being the entry point for everything. Ideally I'd like to be able to set the assembly's appConfig values from the bu...

GetDC() DllImport for x64 apps

If you make a little research on the internet you'll see many DLLImport styles for this user32.dll function: HDC GetDC(HWND hWnd); The question is: what type is more appropriate for .NET x64 apps (either compiled with the Platform target as AnyCPU on a x64 machine or specifically as x64)? IntPtr for example grows to a size of 8 on a x...

What is the best way to handle navigation with PRISM?

Using Prism - what is the best way to handle navigation in a WPF application? And how do you apply this? Are there any best practices? In my application I'm currently using Event Aggregation. Any menu item or other item that should result in navigation in the program will publish an event, and the module responsible for opening the vie...

What is the difference between System.Drawing.Color and System.Windows.Media.Color?

Basically, why the need for two abstractions of a pretty simple concept? ...

Ho to hide a modal dialog without returning from .ShowDialog?

I have an application in vb.net that starts with a sub function do some things and decide if it shows itself or not. When it shows itself it do so by invoking dialog.ShowDialog(). When dialog.ShowDialog returns the application does some cleaning and end. I'd like to find a way to temporarily hide the dialog (send it to the system tray)...

How to change the axis divider line colors in Microsoft Chart Controls (column chart)

See the chart below. I'm building the chart programatically, so no asp.net control syntax please. How do I change the grid line colours that cross horizontally and vertically behind the bars? As you can see I've worked out how to change the actual axis colours, but the grid colours remain black. public ActionResult RenderChart() { ...