.net

.NET Listview Copy Items

Is there a way to copy the entire contents of a listview from one control to another, without manually setting up the second one and iterating through each item? I'm thinking something like: ListView myNewListView = new ListView(); lvwExistingView.CopyTo(myNewListView); Or even: ListView myNewListView = new ListView(); lvwExistingVi...

.NET Presentation Tier Architecture / Blueprint for Line of Business Systems

We are revisiting our presentation tier architecture as a blueprint for future new, and re-written business systems (Just the presentation tier), using Microsoft technology stacks. We have around 30 .NET systems (2, 3 and 3.5), about 60% of which are web based (CWAB + Web Forms) and 40% Smart Client (using CAB / SCSF, WinForms) All syst...

Receiving "...has already been registered..." from EventLog.CreateEventSource even though I'm checking !EventLog.SourceExists

My following code fails with "...has already been registered as a source on the local computer" even though I'm doing checks first: lock ( eventLock ) { string eventLog = Constants.EventLogPL; string eventSrc = Constants.EventSrcPL; if (!EventLog.Exists(eventLog)) { if (!EventLog.SourceExists(eventSrc)) ...

safely Access Dictionary in another thread?

I have a 2nd thread where i run a never ending loop (it listens to incoming TCP request). In that thread/loop i update a dictionary with holds my core data. In my winform GUI i would like to access the dictionary and display info. However if i write a foreach loop i get the exception that the dictionary has been modified. How do i safe...

How to provide a cross platform, asynchronous service interface

What is the best way to provide an asynchronous service interface to multi-platform (primarily java and .net) clients? The backend service is implemented in java. We are looking at asynchronous web service and message queues, but apparently cross platform asynchronous web service* is not supported yet in java (as far as I know) and fo...

How do I generate a set of random strings in a C# program so that they are not trivially predicted?

I faced a following problem: generate N unique alphanumeric strings from a restricted alphabet. Here's my solution in C#: string Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; Random generator = new Random(); const int ToGenerate = 10000; const int CharactersCount = 4; ArrayList generatedStrings = new ArrayList(); while( generatedSt...

"sc.include" tag in Sitecore web.config

Can someone explain me how "sc.include" works? Can use it to include custom config files and handle it as usual custom section in .NET? ...

WindowLicker for .NET's WinForms?

Is there anything like WindowLicker(a GUI test framework) but for .NET's WinForms? Thanks ...

Localization of Text File resources in .NET

Localization/Globalization is pretty easy in Visual Studio using RESX files. I just add a resource file, like MyTextSnippets.resx, add key/value pairs, and create copies for every language I'd like to support like MyTextSnippets.de.resx, MyTextSnippets.fr.resx etc. Now think of longer texts, where the String resource editor grid doesn't...

Ajax Toolkit client only scripts

Could any one tell me if it is possible to still download the AjaxControlToolkit-ScriptFilesOnly.zip cant seem to find them in the latest release on codeplex. I did manage to find them in an earlier release. I did have a look at the source code and it looks like the solution has been refactored and file names has been changed a bit. wou...

Programmatically get the current Exception

Is there an equivalent construct within managed .NET (or C#-specific) code to the ICorDebugThread::GetCurrentException method, or the $exception helper that you can use in a watch window / within MSDEV. It would effectively give an Exception object for the current thread. An example use would be to detect if a method has been called fr...

Does .Net load references up front, or only when it needs them?

If a .Net exe has a normal reference to a .Net assembly, will it load the assembly immediately when the exe is loaded, or will it wait until a class from the referenced assembly is used? ...

Start Windows Task from Outlook Macro

Is it possible to run a scheduled Task in Windows Server 2008 from an Outlook Macro? Background is that it should be possible to start this task on incoming emails with a special subject. The task normally runs every day, but sometimes it should be triggered manually and not everybody has access to the server. Maybe someone has a solutio...

Listview and rowspan

<tr> <td rowspan=2>outer listview</td> <td>inner listview</td> <td>inner listview</td> <td rowspan=2>outer listview</td> </tr> <tr> <td>inner listview</td> <td>inner listview</td> </tr> i want to have this kind of structure for a listview where the first and last td are outer list view, second and third td are inner li...

Datagrid tree (two levels) - dynamically generated grids cannot be altered

I am trying to implement a tree view datagrid with two levels. I am binding my data as follows: private void BindData() { string sqlQuery = "SELECT dept_code, dept_name FROM Department"; conn = new SqlConnection(); conn.ConnectionString = @"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\saher\Documents\T...

.NET Label.TextAlign seems not to work

I have a label that I want to right align to be able to place aligned to a text box. The Designer in Visual Studio 2010 Express have generated this code for me this.lblAddData.AutoSize = true; this.lblAddData.Location = new System.Drawing.Point(167, 452); this.lblAddData.Name = "lblAddData"; this.lblAddData.Size = new System.Dra...

Identify properties not entered for an object in MVC.net

I am currently working on a .net MVC solution where the model is basically built up from several entities that are defined in an EDMX. The problem that I have is that if a user does not enter a value for a non nullable value (in this case a decimal) the null value can't be identified as we can't put null in the model. I know you can ...

Error string in catch block?

i have the following code which show error from a string when there is a error is there any way that i can make this in catch block? main() { try { if (a==1) { string = "error1" } elseif (a==2) { string = "error2" } } } catch (e) { } Like below: i have the followi...

Capture a video frame to a bitmap

I'm using Microsoft.DirectX.AudioVideoPlayback.Video class to play a video file and I would like to capture some frame to a bitmap. The only export feature of this class is the RenderToTexture method and it accepts a Direct3D device as a parameter. Someone know a simple way to obtain a System.Drawing.Bitmap from this method? ...

How to disable windows startmenu using vb.net?

I am trying to disable windows start menu key and Control+Esc and Alt-Tab for a Quiz project. Where user cannot press Startmenu. I was successful in disabling Ctrl+Alt+Del and Ctrl+Shift+Esc. OS is XP. ...