.net

Do all Standard C++ features work in C++/CLI?

If I just include existing Standard C++ class in C++/CLI program, will it work? In my tests everything worked pretty good, but is it true for every program? ...

Getting a KeyValuePair<> directly from a Dictionary<>

I have System.Collections.Generic.Dictionary<A, B> dict where A and B are classes, and an instance A a (where dict.ContainsKey(a) is true). Is it possible to get the KeyValuePair containing a directly from the Dictionary? Or do I need to create a new KeyValuePair: new KeyValuePair<A, B>(a, dict[a])? ...

Rss and Atom framework and Extensions

We have many nice Rss and Atom frameworks. Personally i like Argotic Framework from CodePlex. But the problem is in diversity of extensions (see http://rss-extensions.org/wiki/Main%5FPage). First feed may be created without extensions, second with only itunes, and third with itunes, media and so on. Sometimes an item can consist of sho...

Icons in .NET buttons.

I have just started coding my Computing project for my A-Level, and I will admit, I am far more experianced in 6 than .NET (as embarrassing as that is to say). I get extra marks for making everything presentable, so was wondering if it was possible to add icons into .NET buttons. For example if I have a button to add an entry to the dat...

Porting a console application to WPF

I have created a small chatting application in C#, and started as a Console Application. However I want to create a GUI for it using WPF. It's a class named DanMessengerClientwith functions such as InitializeConnection(), SendMessage(string msg), etc. I have already designed the UI in Visual Studio, and it created it's Window1 class on ...

Anyone successfully installed .net framework 4.0 Beta2 on Windows 7 (64 bit)?

Hi, I've just installed windows 7 (64 bit) and sql server 2008 with sp1. Everything seemed fine until now. I've now downloaded .net Framework 4 beta 2 and am trying to run the installer and i get "unable to create new files in the folder into which files are being extracted." Can any one tell me what i'm missing? Has anyone been success...

Making a memory intensive background application "friendly"

I have an application that periodically needs to process large blocks of data with a computationally trivial algorithm. It turns out I can also prevent slowing down the system from hard drive accesses by keeping the blocks of data in a memory cache. The application is a low-priority application so I'm working to minimize its impact on th...

Hide scrollbars of a RichTextBox

I'm trying to write a simple text editor like DarkRoom with just a RichTextBox (or alternatively a TextBox) in it. My problem is that I can't use the mouse wheel for scrolling unless I have a vertical scrollbar. Is there any way to hide this scrollbar and still be able to scroll with the mouse wheel? So far I have several ideas how this...

A dictionary where value is an anonymous type in C#

Is it possible in C# 3.net to create a System.Collections.Generic.Dictionary<TKey, TValue> where TKey is unconditioned class and TValue - an anonymous class with a number of properties, for example - database column name and it's localized name. Something like this: new { ID = 1, Name = new { Column = "Dollar", Localized = "Доллар" } }...

What is the purpose of the sorted bit vector field in the "~" Metadata header in a .NET assembly?

According to the Partition II metadata, it says that the valid field is a bitmask that notes which CLR metadata tables are present in a .NET executable--but what I can't figure out is what the "sorted" field is for--what is its significance, and what should I emit into this field when creating my own .NET portable executable images? ...

WIll LINQ cache a value if a select for it presents twice?

I have a LINQ query to a DataTable: var list = from row in table.AsEnumerable() group row by row.Field<byte>("ID") into g select new { ID = g.Key, Name = (from c in g select c.Field<string>("name")).First(), Localized = (from c in g select myDic[c.Field<string>("name"))].First(); }; where ID is a primary column, N...

Adding rows to DataGridView in VB.NET

I have a DataGridView set up with the following columns: Teacher, Subject, Date, Period. After a lot of Googleing I can see there are a few ways to add data to the grid programmatically, with each one differing to another quite extensively. I wanted your opinion on how I should go about this, considering I am going to be adding data f...

How to use an extensibility dll for designer support

I've written a UITypeEditor and it works when the editor lives in the same assembly (or one of the referenced assemblies) as the types using it. Then I can use something like: [Editor(typeof(MyUIEditor), typeof(UITypeEditor))] However, I'd like to move this to a separate assembly, one that is not referenced by the assemblies with type...

Invoking UI delegate causes UI to be hidden...

Hi, Suppose I have thread 1, the main window UI thread and thread 2, a login UI thread that is modal form. Now thread 1 executes a piece of code and wants to change a UI element in the login form so it invokes a delegate to change something in thread 2. But when it does so, the login form becomes hidden behind the main window and there...

.net - For Each Obj as MyObject in MyArray -- Is this doable without implementing anything?

I'm using VS2008. Is the following OK to do the following VB.NET with a very simple class (see below)? for each CurrentObject as MyObject in MyArray 'access current object next The "simple class": Class MyObject public I as integer end class I seem to remember that something about needing iEnumerable, but my compiler isn't com...

What is the best practice to handle CheckBox Control in WinForm?

The winform: The code: using System; using System.Windows.Forms; namespace DemoApp { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void checkBox1_CheckedChanged(object sender, EventArgs e) { groupBox2.Enabled = checkBox1....

Manipulation of Visual Studio 2008 Solution and Project files

.Net; EnvDTE; Visual Studio 2008; I've written a simple console app. to create a new instance of Visual Studio 2008; followed by opening a solution into this instance (making use of the EnvDTE namespace). In Windows Task Manager devenv.exe loads in the background but the solution task a long time to load. Actually the solution is quite ...

.NET - What is the best/correct way to iterator through a List and remove misc. members?

In C++ using std::list, this is a simple matter of erasing what an iterator is pointing to (the erase statement returns the next valid member of the list). What's the best way to iterator through a list and remove members that match a certain criteria? ...

Regex replace/search using values/variables in search text

What is the regex syntax to use part of a matched expression in the subsequent part of the search? So, for example, if I have: "{marker=1}some text{/marker=1}" or "{marker=2}some text{/marker=2}" I want to use the first digit found in the pattern to find the second digit. So in "{marker=1}{marker=2}some text{/marker=2}{/marker=1}" the ...

.NET containers - when are members By Reference, By Value?

I migrate between C++ and VB.NET in my coding ventures... which leads to the occasional confusion about when something is by value or by reference in VB.NET. Let's say for example that I have an array of MyObject which is populated with a bunch of objects. dim MyArr(5000) of MyObject Now let's say that the information from this array...