.net

Code Pointers in VS.Net 2003 are out of whack.

I have a .net 1.1 project in VS.Net 2003 (using C#) in which I can set a breakpoint in one method, and step through code just fine, but when I hit one specific method (which we also wrote), the breakpoints and code pointers go "whacky", for lack of a better term. If the breakpoint is on line 100, the execution pointer stops on line 101....

How to show a Context Menu when you right click a Menu Item

I am porting an MFC application to .NET WinForms. In the MFC application, you can right click on a menu or on a context menu item and we show another context menu with diagnostic and configuration items. I am trying to port this functionality to .NET, but I am having trouble. I have been able to capture the right click, disable the clic...

"net use" command in a Windows Service

Hello to all, We're using the following command line from within a Windows Service developed with C# .Net Framework 1.1: net use z: \\myComputer\c$ The service is running under a domain account that is a local administrator on "myComputer". After debugging the code we can see that it does not return any errors but the "z:" drive is n...

What do Streams do when implementing AES encrption in .NET?

Hi, The Rijndael encryption algorithm is implemented in .NET using 3 streams in the following example: Rinjdael. Can someone explain to me what these streams are doing? How/Why are they used? // Declare the streams used // to encrypt to an in memory // array of bytes. MemoryStream msEncrypt = null; CryptoStream csEncrypt = null; Stre...

.Net WinForms Design Time Rules

I have an object that starts a thread, opens a file, and waits for input from other classes. As it receives input it writes it to disk. Basically, it's a thread safe data logging class... Here's the weird part. When I open a form in the designer (VS 2008) that uses the object the file gets created. It's obviously running under the d...

How Do You "Lock" the focus of a form to a specific control?

How does one lock the focus of a .net application to a specific control? For example, if I have a form with 5 text boxes, and I want them filled out in a specific order, how can I stop someone who is in box 1 from tabbing/clicking to box 2, or hitting OK or Cancel or anything else? Is there an easy way, or do I have to manually disable...

C# - ODP.NET and ora-01475 must reparse cursor to change bind variable datatype

Hi all, I'm getting ora-01475 whenever I try to insert a null value in a column (of type DateTime) after some records have already been inserted that have real date values. I'm using the OracleParameter constructor that takes the name and the value as an object (I assume the data type is then implied from the datatype of the object), bu...

Learning C#, ASP.NET 3.5 - what order should I learn in / what to skip?

There's a lot to C# & ASP.net. Where should I start? What should I not bother focusing on? Should I learn Winforms then WPF? Ditto for webforms / Silverlight? Should I learn ASP.MVC or classic ASP.NET? If both, which first? In the either/or cases - which will make more sense having known the other first? What major .NET feature(s) sho...

Picking up a VB6 project for a non-VB6 guy

I have been given the task of modifying a VB6 project. Nothing incredibly serious, adding a couple forms and fixing a few bugs for the most part. The project uses SQL Server (if that is of any relevance). My background in programming has been VB/C# .NET, PHP, C++ and mostly MySQL although I have used SQL Server on a much smaller scale. ...

ASP.net 2.0 GridView Columns dependant on multiple columns in the bound result set

I'm working with an ASP.net 2.0 GridView control that is bound to the results of a sql query, so it looks something like this: <asp:GridView ID="MySitesGridView" runat="server" AutoGenerateColumns="False" DataSourceID="InventoryDB" AllowSorting="True" CellPadding="4" ForeColor="#333333" GridLines="None" OnRowCommand="GridView1_RowComman...

Pattern for specialization of generic class in C#?

In C# I sometimes wish I could make special methods for certain "instantiations" of generic classes. UPDATE: The following code is just a dumb example of a more abstract problem - don't focus too much on time series, just the principles of "adding extra methods" for certain T. Example: class Timeseries<T> { ... TimeSeries<T>...

SpeechSynthezier.PhonemeReached event and control characters

I am creating a small silverlight widget which pronounces a word and highlights each syllable as it is pronounced. As part of this, I am using the SpeechSynthesizer.PhonemeReached event to determine the start and end times of each phoneme (as a step in figuring out the start and end times of each syllable). The weird thing is that the ...

SQL Identity (autonumber) is Incremented Even with a Transaction Rollback

I have a .net transaction with a SQL insert to a MS SQL 2005 DB. The table has an identity primary key. When an error occurs within the transaction, Rollback() is called. The row inserts are rolled back correctly, however the next time I insert data to the table, the identity is incremented as if the rollback never occurred. So essenti...

ASP.net Profiles and Membership - Custom Providers or should completely I roll my own?

Hello, first off, I know that this question could be borderline-duplicate to this one, and yes, it is a bit ironic that I am asking a question for something that I even answered myself. Now, I am talking about ASP.net Profiles. I am building an application using MVC if that matters, and I believe that the built-in Profile Provider is u...

Use custom MSBuild tasks from the same solution?

I'm a new to MSBuild and wanted to play around with it a bit, but I just cannot figure out why this isn't working. So my solution has two projects: "Model" and "BuildTasks". BuildTasks just has a single class: using Microsoft.Build.Utilities; namespace BuildTasks { public class Test : Task { public override bool Execute(...

MVP and IOC in Windows Forms?

I’ve started using the MVP pattern in a Windows forms app for a couple of my forms. These forms create a presenter and pass themselves back to the presenter. I’m not using any particular framework and forms are still able to open other forms. Should I change this setup so that presenters can open other forms (via views)? I believe wou...

Drawing on top of controls inside a panel (C# WinForms)

I know this question had been asked more than a few times, but so far I haven't been able to find a good solution for it. I've got a panel with other control on it. I want to draw a line on it and on top of all the controls in the panel I came across 3 types of solutions (non of them worked the way I wanted) : Get the desktop DC and ...

Cancelling asynchronous remoting call

Hello, I have a client-server architecture where client communicates with the server using .NET Remoting. Server handles all business logic and database interaction. I need to add an operation which may take a while to execute and the dataset it returns might be quite large. I'm thinking of employing asynchronous call for that. Now the ...

Firefox sending request twice

I'm trying to process a credit card transaction in .net and it works perfectly in Safari, Opera, and IE. When I try the same transaction in Firefox it sends two requests and I end up with a double charged card. From a quick search on Google it seems that this is an issue with Firebug but I am unable to find a way to stop this double post...

WPF DocumentViewer doesn't release the XPS file

hello! I am working on a WPF application that opens and displays XPS documents. When the application closes, the specification is the application should delete the opened XPS document for clean up. However, when opening a certain XPS document, the application throws an exception that the file is still in use when it tries to delete it. ...