.net

Design Principle: Is there ever a reason to turn TabStop off?

In Visual Studio .NET the TabStop property is by default set to True for all command and input fields. Most other designers have some concept of tab control for "power users" who don't like to switch to their mouse a lot. This property simply toggles the ability for the control to receive focus when the user hits the tab button to iter...

How to calculate the disabled text color for controls that look very close to Winforms controls?

I am using CustomButton and CustomLabel derived from Button and Label. They have extra functionality that I need. The visual difference is minimal but I don't know how .NET calculates Winforms disabled colors. ...

Is it possible to override the auto-indentation of comments in VB.NET/VS2008?

Is it possible to override the auto-indentation of comments in VB.NET (Using visual studio 2008)? Please see the comment above the second Case Statement in the code below for context. The IDE auto-indents the comment beyond the following Case Statement. I would like to override this behavior and bring it in line with the C in Case that...

Problem with certificate

Hi, I´m developing a tool (ASP.NET page that generates a file with stamped with a private key to be validated later on other app. I´m using makecert for the certificate creation: makecert -sky "privatekey" -sk "MyCompany"-n "CN=MyCompany" -ss -pe CertFile.cert The generated cert is on my dev machine. Then I run this code and It can ...

Limitless String in .net

This is a question that has been bugging me for a while and I am no longer working in this so sorry for the lack of code. The situation is this I had a web service that in the client and the server page it had compression and it had encryption. It didn't work all the time because there was accents and that crashed the encryption but when...

Is the .NET Stream class poorly designed?

I've spent quite a bit of time getting familiar with the .NET Stream classes. Usually I learn a lot by studying the class design of professional, commercial-grade frameworks, but I have to say that something doesn't quite smell right here. System.IO.Stream is an abstract class representing a sequence of bytes. It has 10 abstract method/...

[C#] Creating my own component with DataSource and DataBind()

Hi, I want to do my component that works similar to most of data controls (MS, Telerek, etc.): myControl.DataSource = new List<myClass>(); mycontrol.NameField = "Name"; myControl.ValueField = "Value"; myControl.DataBind; I have some test code: class myClass { public String Name { get { return _name; } } ... } class c...

Problem using Seq.cast

Using Seq.cast seems to constantly fail, even for something as simple as the following: let xor c = Seq.cast c |> Seq.reduce (^^^) xor [1;3] // Works, assuming because no cast is necessary xor ['a';'b'] // Fails xor [2u] // Fails The latter two fail with Specified Cast is not valid. What am I missing? I'm trying to use...

How to DataSet.Fill with DateTime values defaulting to DateTimeKind.Utc?

I have an application which would read data from SQL and send it via WCF to a client app, in a manner similar to this: SqlDataAdapter da = new SqlDataAdapter( cmd ) DataSet ds = new DataSet(); da.Fill( ds ); return ds; All the date/times are stored in the database as UTC. What I noticed is that if clock on computer running the applica...

C# Thread Creation Question

When creating a new System.Thread instance the default value of IsBackground is false. Can anybody shed the light on why this would be the default value would be not be true. My inclination, correct or not, when creating a thread is that it would be run in the background of the main thread. Thank you for the quick responses. I do provi...

Diagnosing runaway CPU in a .Net production application

Does anyone know of a tool that can help me figure out why we are seeing runaway CPU in a managed app? What I am not looking for: Process explorer, it has this awesome feature that lets you see CPU per thread, but you do not get managed stack traces. Also, it requires a fairly proficient user. Windbg + SOS, it could probably be used ...

Can I declare a character encoding when using XStreamingElement to write a large XML file?

I'm using XDocument and XElement objects to write a large XML file (currently 8MB). I'd like to switch to XStreamingElement so that I can write the file without having all the data in memory at once. Unfortunately, I need to include an encoding declaration. Can I do that without using an XDocument? ...

when to use or not Lambda Expressions.

I see lambda expressions have become a very useful tool at some points in the language. I've been using them a lot and most of the time they fit really nice and make the code shorter and perhaps clearer. Now.. I've seen some , I would say excessive use of them. Some people like them so much that try to use them everywhere they can.. Som...

Consume Google Map API from VB .NET windows APP

Hi, 1. I have a VB .NET windows App I have two locations: StartPoint = "Minneapolis MN US" EndPoint = "Dallas TX US" I want to call Google Map API's GDirections.load(xxx) and GDirections.getDistance() and get (Expecting) some XML formatted data that will give me the Distance between the two locations. I can probably use VB .NET web...

can I "cancel" mouse move and make the mouse cursor remain visible but in place?

I am implementing shape resizing using corner handles. In some cases, certain moves with the mouse holding the handle are not legit, e.g. if it will in effect extend it beyond the control boundary. So what I would like to do in this case is "cancel" the mouse move in flight programmatically, so that the mouse would just stay within the b...

How to split an animated gif in .net?

How do you split an animated gif into its component parts in .net? Specifically i want to load them into Image(s) (System.Drawing.Image) in memory. ====================== Based on SLaks' answer i now have this public static IEnumerable<Bitmap> GetImages(Stream stream) { using (var gifImage = Image.FromStream(stream)) { var dimens...

Does Mobile phone have Server : Port Scheme ?

Hi I hope I can get all the help i can get here. I am new to mobile phone programming. I find networking very interesting and I have this question: Does Mobile phone like WinMo or other phone have Server:Port scheme and what are the ports ? To show what I mean, I use PC to demonstarte, there are many ports ( restricted and establish...

.NET: Blog post on GUID?

I once read a blog post by a dev at Microsoft about the anatomy--what individual pieces of data are combined--of a System.Guid. Does anyone have the link? I'm not finding it by googling. ...

C# - Multi-touch help? USB web cam input? Image Analysis?

I am trying to make a DIY touchscreen and would like to enter it into the local science fair but wanted to do it on the programing aspect of Multi-touch. My problem lies in that i have never worked with analyzing images (from a USB based web-cam). I would like to do this project in C# if possible (C++ - if worst comes to worst) I need...

Manage errors among Dev Teams

We are going through some very interesting debates as to how we should manage errors/issues in our IT department. I would really like to hear what others say about how they manage application/feed, etc generated errors. We are being pushed to put everything into BPEL (Business Process Execution Language) so that the non devs can see w...