.net

Specifying a unique control name when adding at runtime (like the VS IDE)

hi, I have a basic IDE for a user control i am building. It allows me to add labels to a panel and move them around, like a very basic form designer. When I add the controls to the panel at runtime, I'd like to give the control a unique name string like how the VS IDE tracks the controls it already has and adds an extra number when it ...

Can you data bind to a property that contains parameter in Silverlight?

In silverlight, can you bind to a property that contains parameter? For example, the following doesn’t seem to work. Am I missing something or is this not possible? C# private System.Collections.Generic.Dictionary<string, string> ValuesField = new System.Collections.Generic.Dictionary<string, string>(); public string Value { get { ...

Issue with usercontrol BorderStyle

I have created a user control (custom DataGridView control). I have used the example in this MSDN article to set the border style. I am able to see the selected border style in designer. Like None, FixedSingle or Fixed3D. But when I set the border style to FixedSingle, the border does not appear at runtime. Do I need to draw it manual...

In C# how to show a GUI from another GUI, based on the event from a class in another thread?

I am working on a DirectX based simulator. On which I have to check for a device whether device has been plugged-in or removed from the PC. I've managed to make classes for device arrival and removal on another thread, which raises an event from the thread itself on device arrival or removal. The corresponding event method is being call...

access property value of one class from another internal class in C#

how do i acces the property value from an internal class , see below? namespace N1 { public class ClassA { string var1 = null; private ClassB b; public ClassA() { var1 = "one"; b = new ClassB(); } //property public string Var1 { get{ return v...

Binding to a dictionary in Silverlight with INotifyPropertyChanged

In silverlight, I can not get INotifyPropertyChanged to work like I want it to when binding to a dictionary. In the example below, the page binds to the dictionary okay but when I change the content of one of the textboxes the CustomProperties property setter is not called. The CustomProperties property setter is only called when CustomP...

Can I use Ninject ConstructorArguments with strong naming?

Well, I don't know if "strong naming" is the right term, but what I want to do is as follows. Currently I use ConstructorArgument like e.g. this: public class Ninja { private readonly IWeapon _weapon; private readonly string _name; public Ninja(string name, IWeapon weapon) { _weapon = weapon; _name = ...

Create unmanaged c++ object in c#

I have an unmanaged dll with a class "MyClass" in it. Now is there a way to create an instance of this class in C# code? To call its constructor? I tried but the visual studio reports an error with a message that this memory area is corrupted or something. Thanks in advance ...

Is INotifyPropertyChanged only for the presentation layer?

The INotifyPropertyChanged is obviously very useful in the view model for data binding to the view. Should I also use this interface in other parts of my application (e.g. in the business layer) when I want notifications of property changes, or I am better off using other notification mechanisms? I realize that there is nothing stopping...

DbDataReader with DbTransactions

Its the wrong way or lack of performance, using DbDataReader combinated with DbTransactions? An example of code: public DbDataReader ExecuteReader() { try { if (this._baseConnection.State == ConnectionState.Closed) this._baseConnection.Open(); if (this._baseCommand.Transaction ...

.NET Graphics.ScaleTransform converts print job to bitmap. Any other way to scale text?

I'm using Graphics.ScaleTransform to stretch lines of text so they fit the width of the page, and then printing that page. However, this converts the print job to a bitmap - for a print with many pages this causes the size of the print job to rise to obscene proportions, and slows down printing immensely. If I don't scale like this, the...

WCF - Network Cost

Dear Devs I have a wcf service deployed on IIS with basicHttpBinding and aspNetCompatibilityEnabled=true I have a test client as well which invokes multiple service functions simultaneously. To check the performance of service call on client and server I calculated the Avg time it takes to complete a service request on client(in proxy...

c# copy all text from webbrowser control

is it possible to scrape all the text from a site that was navigated to by webbrowser control without looking at the source? ...

.net byte[] to List<List<Point>>

Is is possible to convert a byte array back to a List<List<Point>> ? LE: I am saving the List<List<Point>> in a database BLOB field. When I retrieve it, I want to convert it back to a List<List<Point>>. The data is kept into an SQLite database and gets set with: ... cmd.Parameters.AddWithValue("@bynaryData", theList); ... So I have...

How to catch all un-handled exceptions in a .net assembly (library type, not application).

Hi, I have an assembly containing a number of classes. This is a class library type assembly, not a windows forms application. It's also single threaded. Is there a way to catch all un-handled exceptions so that I can log them? ...

c# rendering html into text

i want to be able to take html code and render plain text out of it. another words this would be my input <h3>some text</h3> i want the result to look like this: some text how would i do it? ...

How can we cast Frame.Content to a Page type in WPF

Hi; Basically; I need to invoke a method on my WPF page, from a WPF frame where I load the WPF Page. I get the loaded page using Frame.Content property, and cast it to my page type since Content property returns Object type. The project builds successfully, however it throws InvalidCastException at runtime. //This line throws InvalidCas...

Best way to get a single value from a DataTable?

I have a number of static classes that contain tables like this: using System; using System.Data; using System.Globalization; public static class TableFoo { private static readonly DataTable ItemTable; static TableFoo() { ItemTable = new DataTable("TableFoo") { Locale = CultureInfo.InvariantCulture }; ItemT...

Creating simple c++.net wrapper. Step-by-step

I've a c++ project. I admit that I'm a complete ZERO in c++. But still I need to write a c++.net wrapper so I could work with an unmanaged c++ library using it. So what I have: 1) unmanaged project's header files. 2) unmanaged project's libraries (.dll's and .lib's) 3) an empty C++.NET project which I plan to use as a wrapper for my c# a...

Response.Redirect doesn't work in .net 4

where used on http://localhost:8692/Contacts/Default.aspx Response.Redirect("http://www.google.com") redirects to http://localhost:8692/Contacts/http%3a%2f%2fwww.google.com The problem just appeared once I upgraded to .Net 4 Edit: Response.Redirect("~/Contacts/MemberDetails.aspx?Id=3") goes to http://localhost:8692/Contacts/%2fContacts...