.net

Data Grid View -- binding columns to list

Hello, My project in c# cantains dataGridView and i have a object contain data. public class Data { public List list {get;set;} } the data is init at program start up and the length of list can change. i want to bind the gridView to object that when gridView show each columns in gridview is bound to list in data object like this:...

define get or set in c#

hi friends i have problem with using get or set in class in c# when i use get or set in gives error(invalid token { in class) pls, see below code,i have this problem in it static int abcd { get { return _abcd; } } thanx this is the complete code,i dont have this problem with any of your codes ...

Use threads during iteration

There is a collection and each element of that collection is sent to a function where 5 threads have to work on it. How to make 5 threads work on the passed item? foreach(var item in collection) { doSomeWork(item); } void doSomeWork(object item) { //here i have to do something with the passed 'item' by using 5 threads } ...

Android Converting .NET Path.Combine to java?

We are converting apps to Android from .NET Is there a Java equivalent of the .NET Path.Combine() function? Currently we check the / on each folder etc before building paths. ...

Desktop Application - Datagrid data parsing

I have a 3rd party desktop weather application. It has a datagrid with few columns. I need to read all the non-zero enteries of 3rd column. I started exploring AutoHotKey, but hit road blocks. Now, looking into Microsoft Spy++. It is displaying the control names, buttons, text on the main control. But, it is not displaying the contents o...

How to do really mutithreaded web mining with IE/.Net/C#?

I want to mine large amounts of data from the web using the IE browser. However, spawning lots and lots of instances of IE via WatiN crashes the system. Is there a better way of doing this? Note that I can't simply do WebRequests - I really need the browser due to having to interact with JS-driven behaviors on the site. ...

.NET Mutex on windows platform: What happens to them after I'm done?

I've got a simple .NET program, which checks to see if another instance has been started: Mutex mutex = new Mutex(false,"MyMutexName"); if (!mutex.WaitOne(1)) return; try{ //do stuff } catch{ //exceptions} finally { mutex.ReleaseMutex(); } My question is, what exactly happens to the...

Dispose of a .NET application before Application.Run is complete

I have a project that shows a UI when no proper command line arguments are passed. It's is a simple utility built to dynamically update a desktop wallpaper. When it's done with its update I call this.Dispose(); but this causes an issue if command line arguments are passed. The form actually ends up getting the Dispose method call bef...

Issue recomposing on an ImportMany with MEF

I've got a property defined on a class that has the importManyAttribute defined for it, the declaration is as follows: public const string FontStyleProvidersPropertyName = "FontStyleProviders"; [ImportMany(typeof(IFontStyleProvider), RequiredCreationPolicy = CreationPolicy.Shared, AllowRecomposition=true)] public List<IFontStyleProvider...

.NET: Screen saver configuration dialog owner and preview focus

I have created a screen saver (C#, .NET 4.0 if that matters) but I have a couple of problems (on a more cosmetic level, though). These are probably easy to solve, but I have prettu much never used the Win32 API, so I can easily miss the obvious when it comes to that. Q1: I set up the small preview window like this: SetParent(Handle, h...

Which implementation of Ruby will survive?

From what I've heard there was IronRuby and Ruby.NET and a few other variations. I've also heard that Ruby may not be supported anymore by Microsoft as they started to lay of much of that development group. I'd like to know which implementation(s) of Ruby is likely to survive, and which one will be adopted into large enterprises. It w...

Automatically embed multiple icons in a .NET Executable

I basically have the same issue as this question: Embed multiple icons in WPF EXE My .NET 2.0 WinForms application currently has this when you click "Change Icon" in explorer: What I would like to see, and with some hacking about as suggested by the above article I get this: However the process of getting there all of the version ...

What would cause this code to produce a file lock error?

The code below writes to a text file in a while loop and sometimes it will produce an error saying that the "The process cannot access the file because its being used by another process" etc..." The error usually happens on "using (FileStream fs = File.OpenRead(filePath)) " Is there a way to check the file is no longer being used or a wa...

Tutorial for using cucumber and rspec with .net apps

Are there any good tutorials out there for using cucumber and rspec for testing .net applications? ...

Locally unique identifier

Question: When you have a .NET GUID for inserting in a database, it's structure is like this: 60 bits of timestamp, 48 bits of computer identifier, 14 bits of uniquifier, and 6 bits are fixed, ---- 128 bits total Now I have problem with a GUID, because it's a 128 bit number, and some of the DBs I'm using only support 64 bit numbers...

Programmatically access Enterprise Library Logging configuration (object model)?

I'm using Enterprise Library 3.1 and want to programmatically access the Logging Block (runtime, object model) specifically its Trace Listeners and Sources. For example, I want to access the Filename property of a trace listener object so I can know where the log file is located on disk. Update: Looking for answers that use the runti...

Error connecting to MySQL Database using .NET.

When I try to connect to a MySQL Database from my .NET application i keep getting the error: ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified I went to this URL and downloaded/installed the Windows, MSI Installer Connector-ODBC but I am still getting the error. Is there ...

Prevent method from showing up in Stack Traces

Using the .NET CLR, is there a way to prevent a certain method to show up in the stack trace? Especially I just want to remove the last call from the stack trace before throwing an exception. I'm just curious, unsafe calls and reflection hacks are valid solutions. ...

What does ">>" operator in C# do?

I ran into this statement in a piece of code: Int32 medianIndex = colorList.Count >> 1; colorList is a list of class System.Drawing.Color. Now the statement is supposed to retrieve the median index of the list .. like the half point of it .. but I can't understand how that >> symbol works and how the "1" is supposed to give the media...

Correct use of this. in a class constructor

I was browsing some documentation for a physics library for XNA and noticed an example someone had used for creating a class for a Car. This is a pretty simple example: Class Car { private float gravity; private float maxSpeed; public Car(float gravity, float maxSpeed) { this.gravity = gravity; this.maxSpee...