.net

Sending keystrokes to control in .Net

My ActiveX control contains various shapes which are drawn. CTRL-A is used in the control to select all the objects. Similarly CTRL-C to copy, CTRL-V to paste etc. However, when I insert this control within a Windows form in a .Net application, it does not receive these keyboard events. I tried adding a PreviewKey event, and this does ...

C# .NET DataGridView enable cell click only to certain columns

Hi all: I have little experience in C#.NET, and below is what I got so far: I created a DataGridView which bound to an ObjectDataSource(a generic list, that is). Although I can make good use of the DataGridView's CellClick event and its corresponding delegate interface(DataGridViewCellEventHandler) to do my business logic well, I am s...

HTTP Request performance for large volumes of requests

I'm looking for some advice on how to optimise the following process: App reads csv file. For each line in the file an XML message is created Each XML message is posted to a URL via a HTTPWebRequest This process was designed to handle low volumes of messages (up to about 200 at a time), un suprisingly thinks have changed and it is now ...

Efficient way to read index file in .NET

Dictionaries usually has an index and a data file. I'm writing a dictionary application as a hobby project. I'm confused about how to read the offset file in .NET. The index file is of 4-5 MB size. What is the most efficient way to fetch the offset/length value of a word. EDIT: I need to know only how to read offset file if I have a wor...

deep zoom image drag-and-drop issue

Hello everyone, I am using VSTS 2008 + C# + .Net 3.5 to develop Silverlight 3 application using deep zoom. We could use mouse to drag and drop and image. But the image may be dragged out of the viewport area, which makes the viewport area empty -- causing bad user experience. Any ideas how to implement a solution to prevent from draggin...

Advice about insert into SQLCE

i am inserting about 1943 records by these function into SQLCE.This is my insert function.Parameters come from StringReader(string comes from webservice).This function executes 1943 times and takes about 20 seconds.I dropped table's indexes,what can i do to improve it?I create just 1 time mycomm and sqlceresultset. Public Function Inser...

StackOverflowException in LINQ to SQL

We are using LINQ to SQL to work with database in our project and almost all is fine but one thing: sometimes we have to build a huge WHERE condition using some universal query object which is built by user input. To build the predicate to put in WHERE statement we used tricks explained here http://www.albahari.com/nutshell/predicatebui...

Can you convince a DataContext to treat a column as always dirty?

Is there a way to force LINQ-to-SQL to treat a column as dirty? Globally would suffice.... Basically, I've got a problem with some audit code on a legacy system that I'm talking to with L2S, imagine: var ctx = new SomeDataContext(); // disposed etc - keeping it simple for illustration var cust = ctx.Customers.First(); // just for illus...

Reading huge amounts of small files in sequence.

I have this problem: I have a collection of small files that are about 2000 bytes large each (they are all the exact same size) and there are about ~100.000 of em which equals about 200 megabytes of space. I need to be able to, in real time, select a range in these files. Say file 1000 to 1100 (100 files total), read them and send them o...

NHibernate Validator - passing resource manager and key.

Hi, According to the NHibernate Validator documentation here: http://nhforge.org/wikis/validator/nhibernate-validator-1-0-0-documentation.aspx I should be able to pass my resource manager so I can use that for validation error messages. See: Alternatively you can provide a ResourceManager while checking programmatically the valida...

Determining which User Control to call based on browser

I have two user controls in my ASP.Net project, one that is explictly for use with Internet Explorer 6 (IE6) and another that should be used when the user's browser is not IE6. How would I go about setting it up so that this happens; is this something I can put in a master page? ...

EDITED: How should I separate closely related programs in C#? (user client, admin, and common class library)

I have a suite of programs that are related. One is a user client, one is an admin program, and another is a set of library classes that reside in a Class library. How should I separate the projects? Should I put the user client in one project, the admin program in another, and the common library in a third project? Or should they resi...

GetHashCode issue

Hi, Can anyone help explain the following. I am having an issue with a Dictionary where ContainsKey evaluates to false while both Equals and GetHashCode for the objects are successful. Below is the output from the immediate window in Visual Studio: ?LocationToRackingGroup.Keys.ToArray()[23].Equals(location) true ?LocationToRackingGroup...

How do I get hold of my CodeContext in IronPython RC1?

CodeContext is used throughout IronPython. But since I moved to IronPython RC1 I cannot get hold of one. Has anyone used IronPython RC1 and managed to use ClrModule.AddReferenceByName(...) or PythonType.__getattribute__(...) Both of them take a CodeContext and hence I can no longer use them. ...

Binding a DataGridView to a DataTable but also including a ComboBox as the last column

Right now I have a DataGridView that's bound to a DataTable that works all well and good. What I need to do on the DataGridView is include a new column at the very end that is a ComboBox that will dynamically filly based on the key value of the row. My columns are ID, Name and Count. The 4th column will be a ComboBox that takes an ID a...

Writing data to cells in Excel 2007 / PowerShell

Hello, Why can I not write values to Excel using the Worksheet class, or Sheet interface? I would expect to be able to do something like this: [Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Interop.Excel") $Excel = New-Object Microsoft.Office.Interop.Excel.ApplicationClass $Workbook = $Excel.Workbooks.Add() $Worksheet = $...

TFS create project error TF30224

Our TFS 2008 2-tier setup was working fine until this morning when I attempted to add a new project. When I go through the steps to add a project I get the following errors: Error TF30224: Failed to retrieve projects from the report server. Please check that the SQL Server Reporting Services Web and Windows services are running and yo...

How to deploy a hotfix in a ClickOnce application?

I recently discoverd that there is a bug in the dutch .Net assembly that effectively breaks NavigationWindows on dutch vista SP1 or higher. See for details this link A hotfix is available, but how can I distribute this with my ClickOnce application? I am appalled that this situation, that seems to be known since february, has not been r...

Should I pay out of pocket to attend a conference?

I have been programming for about 10 years and most of my experience is in C++, MFC, Win32. I now have a project where .NET is the thing and C# is the preferred language. This is partly due to the fact that almost all the other developers are young and grew up on .NET - and think that C++ == punch cards. I have been learning .NET, C# and...

Parse an integer from a string with trailing garbage.

I need to parse a decimal integer that appears at the start of a string. There may be trailing garbage following the decimal number. This needs to be ignored (even if it contains other numbers.) e.g. "1" => 1 " 42 " => 42 " 3 -.X.-" => 3 " 2 3 4 5" => 2 Is there a built-in method in the .NET framework to do this? int.TryParse() is...