.net

.NET WebBrowser control with Adobe SVG Viewer

I'm having problems with SVG files loading in a .NET 2.0 WebBrowser control. If I create a new WinForms application project, drag a WebBrowser control and a button onto the Form1.cs design surface, and add a line to the button's on-click handler to set the Url property of the WebBrowser control to an SVG file, I get two IE script errors...

Is there a way to create and return new variables from a method in C#?

Basically like using the out keyword. But the problem is with the out keyword, you still have to declare a variable outside the method call, like: double result; Double.TryParse ( "76", out result ); where as I want something like: Double.TryParse ( "76", out result ); and there I get a new variable called result. Is there a way t...

Getting data into a Windows Workflow instance

We're currently building a system that abstracts all kinds of technical details about web services from some other systems. It's a bit like an Enterprise Bus, but it does a little more. We decided to use Windows Workflow to handle the requests. As soon as we figure out what kind of action is requested, we'll start a workflow that is spe...

Exposing events from .NET to COM

Hello everyone, recently I have been encountering problems with exposing events from .NET to COM. I have been successful with this example (conceptually taken from http://blogs.msdn.com/andreww/archive/2008/10/13/exposing-events-from-managed-add-in-objects.aspx): // The delegate type for our custom event. [ComVisible(false)] public de...

Does the Garbage Collector destroy temporarily unreferenced objects during async calls in .NET?

Imagine that I will make an async call in .NET, i.e. HttpWebRequest.BeginGetResponse, and the HttpWebRequest object isn't referenced at a broader scope. Will the Garbage Collector destroy it and cause problems? Example code: using System; using System.Net; public class AsyncHttpWebRequest { void Main() { var Request = ...

Is there a way to return a dotNetObject value from a custom 3ds Max plugin?

I have a custom plugin for 3ds Max that interfaces with some managed code on the back end. In some circumstances, I'd like to forward along a managed object to MAXScript for direct interaction, i.e. return a wrapped object from one of my functions. MAXScript is able to manipulate managed objects directly relatively well through another ...

Silverlight: Binding a child controls property to a property in a user control

If I have a user control defined: public partial class MainFooter : UserControl { public System.Windows.Media.Color BkColor; } and it's xaml: <UserControl x:Class="Test.MainFooter"> <Grid x:Name="LayoutRoot"> <Rectangle x:Name="rctBottom_Background2" HorizontalAlignment="Stretch" ...

Organizing a Visual Studio Solution with "Solution Folders"

When setting up a Visual Studio .NET solution with many projects, do you find "Solution Folders" useful? What are the drawbacks? My original thought was that using Solution Folders can be useful to logically organize like projects within a solution. However, I was surprised to learn that a creating a Solution Folder does not create a ...

XML Deserialization - convert attribute value into class automatically (.net)

(vb.net/c#/etc) I am having trouble figuring out how to do a bit of deserialization magic. Currently the standard deserialization works fine, including the enums, but now I want to convert an attribute into a class. Oh! what was I thinking! My xml looks a bit like this: .... <review user="..." version="2.2">...</review> And this f...

Is WPF on Linux (already) possible?

I love programming with .NET, especially C# 3.0, .NET 3.5 and WPF. But what I especially like is that with Mono .NET is really platform-independent. Now I heard about the Olive Project in Mono. I couldn't find some kind of Beta. Does it already work? Have any of you made any experiences with it? Edit: I know about Moonlight. But I wa...

What really happens in a try { return x; } finally { x = null; } statement?

I saw this tip in another question and was wondering if someone could explain to me how on earth this works? I mean, does the finally clause really execute after the return statement? How thread-unsafe is this code? Can you think of any additional hackery that can be done w.r.t. this try-finally hack? Update 1 well, it seems as though a...

Open FoxPro Table in VB.net 2005

I need to open foxpro free tables in vb.net using the oledb connection. But... i only need to get the column names. I don't really need to 'select' anything. I am trying to dynamically browse through all our free tables and set up a listing of every column from every file and xref that to another free table that contains a description o...

How the best methodology to create an .NET client application supporting plugins?

I found the .net plugin architeture very complex to use as plugin platform. I think that an plugin interface needs be simple to 3rd coders develop with. Do you know/use/etc some plugin techinique more simple and effective? To be more exact, let's imagine that we will develop a text editor like notepad, that needs (by example) plugins fo...

DataTemplate with TargetNullValue in a ListBox

I have the following DataTemplate in a Listbox <ListBox Grid.Column="1" Grid.Row="2" ItemsSource="{Binding People}" SelectedItem="{Binding SelectedPerson}"> <ListBox.ItemTemplate> <DataTemplate> <TextBlock OverridesDefaultStyle="True" Background="{x:Null}" Margin="0" Padding="0" IsHitTestVisible="True" T...

How do I determine the true pixel size of my Monitor in .NET?

I want to display an image at 'true size' in my application. For that I need to know the pixel size of the display. I know windows display resolution is nominally 96dpi, but for my purposes I want a better guess. I understand this information may not always be available or accurate (e.g. older CRT displays), but I imagine with the pre...

How do I programatically modify information stored in Active Directory using .NET?

I'd like to write a .net program to update active directory data in an existing field, or extend the schema to add a new field. Does anyone know the best way to go about this? ...

Determining when a sound has finished playing in C#

Here is the situation: User looks something up. Alert sound is played because there is a notice on the item he looked up User closes the notice - the application continues to retrieve information User is sent a 'ding' telling them the information has finished retrieving Application begins sending certain attributes to TextToSpeech The ...

wmi .net to set serial port?

I have a usb serial adapter that plug and plays at COM9 or higher on many systems. A third party package I am using in my software can only connect up to COM8. Is there some way to set a COM9 down to a lower port using WMI or something? I know I can do this in the port settings dialog in device manager, but it's easier for my end users i...

Overloaded method calling overloaded method

I have a method that I'm writing that is calling another overloaded method inside it. I'd like to only write one outer method, since the parameter to the outer method is being passed to the inner one. Is there a way to do this? I tried using generics, but I don't know enough about this so it isn't working: public void OuterMethod<T>(...

is it possible to optimize that code?

I'm interested in speed, not good looking code, that is why I'm using array and not list(of integer). I have an array looking like: 0,1,0,1,1,0,1,0,1,1,1,0,0,1 I'm interesting in the position of each number so I can later pick one randomly. so what I do is looping through the array to take position number of each 1 then creating a new...