.net

C# Process <instance>.StandardOutput InvalidOperationException "Cannot mix synchronous and asynchronous operation on process stream.".

I tried this myProcess = new Process(); myProcess.StartInfo.CreateNoWindow = true; myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; myProcess.StartInfo.FileName = "Hello.exe"; myProcess.StartInfo.Arguments ="-say Hello"; myProcess.StartInfo.UseShellExecute = false; ...

Correct way to close database connection in event of exception.

Does the following code leave the connection open if there is an exception? I am using a Microsoft SQL compact edition database. try { SqlCeConnection conn = new SqlCeConnection(ConnectionString); conn.Open(); using (SqlCeCommand cmd = new SqlCeCommand("SELECT stuff FROM SomeTable", conn)) { // do some s...

How to make non-blurry image in WPF 3d

I used Viewport3D and ModelVisual3D to create a simple ImageBrush with an image (I tried it with JPG, PNG), but it shows the image blurry, but the original image is very sharp and clear. I don't know how to make it with the original quality in 3D... I also tried some 2D solutions like RenderOptions.BitmapScalingMode and SnapsToDevicePi...

.Net Windows Service to monitor mailbox

Hi there, I need to create a .Net windows service to monitor a mailbox and process attachments (if found) on the emails and then delete the email from the server. I have two questions I'd like your thoughts on: POP3 or IMAP to connect to the mail server? Which POP3/IMAP library should I use. At this stage we're just doing a proof of ...

Dataset to Database

Hello, I'm working with framework 2.0. I have a dataset with many rows that were entered by the user and I need to write them to the database. What is the right way to do it? TY ...

Can I create CRM workflows using .NET 4?

I would like to take advantage of .NET4 for Dynamics CRM4.0. It is great for most things but I get a file not found exception when trying to register a workflow. It can't find System.Workflow.ComponentModel 4.0.0.0. Is there a workaround? ...

C# says this.Controls is null, why?

Earlier my code was running nicely.. then I edited some .. did not touch the designer code. Why this error is being shown? ...

DataGridView Cell Validating only when 'Enter' is pressed

Hi, I want to validate and commit the value entered in the DataGridViewCell ONLY when the user presses the 'Enter' key. If the users presses any other key or mouse button (Arrow keys, Pressing a different cell using the mouse...), I want the behavior to be similar to the 'ESC' key: Move the focus to the new cell and revert the edited c...

How to store user settings(username,password) in a windows application for the current login user

Now my team working in a project using windows application(c#). The application have a option for saving the username & password in the client machine for the current login user.so the user can start the application without entering username & password.I didn't have any knowledge in the windows application.Please check the snapshot of m...

Setting options with Linq

I'm in a situation where I want to add the equivalent of the sql statement SET QUERY_GOVERNOR_COST_LIMIT to my query I created with linq to entities. How would I go about that? ...

How can I get email address of Yahoo Answer users ?

I am using Yahoo Answers API to build a c# desktop application which goes to Yahoo Answers and search for any keyword you enter and it brings the list of questions and their users. I need to get Email Address of those users so that I can send message to them. Anyone tried it ? It is possible ? ...

DateTime: Require the user to enter a time component

Checking if a user input is a valid date or a valid "date + time" is easy: .NET provides DateTime.TryParse (and, in addition, VB.NET provides IsDate). Now, I want to check if the user entered a date including a time component. So, when using a German locale, 31.12.2010 00:00 should be OK, but 31.12.2010 shouldn't. I know I could use Da...

Disable Painting of the VScrollbar in a System.Windows.Forms.RichTextBox

I have a custom control inherited from RichTextBox. This control has the ability to "disable" rich text editing. I achive this by just setting the Rtf property to the text property during the TextChanged event. this is how my code looks like: private bool lockTextChanged; void RichTextBox_TextChanged(object sender, Even...

Benefits of EF4 in a POCO architecture

During DevConnections I veered off the Silverlight track and stumbled into an awesome talk by Chris Sells about EF4. I was really impressed by what is possible now vs 3.5 SP1. At the same time, I'm wondering what benefit there would be in taking a system that is a heavy POCO architecture and inserting EF4 in the mix. Change tracking? LIN...

Is there a shorthand way to denullify a string in C#?

Is there a shorthand way to denullify a string in C#? It would be the equivalent of (if 'x' is a string): string y = x == null ? "" : x; I guess I'm hoping there's some operator that would work something like: string y = #x; Wishful thinking, huh? The closest I've got so far is an extension method on the string class: public sta...

.NET JSON parser comparison

I've been looking into several JSON parsers for .NET (LitJSON, JsonExSerializer and JSON.NET), and was wondering if anyone has any experience with them and can shed some light on the differences and the pros and cons for each of them. ...

CodeAccessPermission in framework code in .Net

If you use reflector to, for example, look at the implementation of the OnMouseEnter method of ButtonBase, it calls IntSecurity.AllWindows.Assert before showing a ToolTip control. Why? ...

UDDI - find service which name matches exactly name specified in request

Hi. I'm asking UDDI to find a service with a name specified in request. The code looks like this: UddiConnection uddiConnection = new UddiConnection(uddiAddress); FindService findService = new FindService(); findService.Names.Add(uddiServiceName); ServiceList foundServices = findService.Send(uddiConnection); However, ...

Is ASP.Net Server Control, Postback Architecture failed in current Web 2.0 World.

What i am looking around me is the drastically change in ASP.Net Architecture. More and more company are following the approach of JSON based wcf service in middle tier. Plain HTML based UI tier with JQuery/Ajax. No Postback at all, This contradicts the Default behaviour of Asp.Net Server Control/Code Behind Event handler/Postback. I ...

Possible bug in ASP.net UpdatePanel control?

I have come across what seems to be an annoying bug with asp.net UpdatePanels in 2 seperate projects. If you have some kind of autopostback enabled control that can cause all of the controls in the update panel to have visible=false set, resulting in an empty update panel. When you change the autopostback control back to the postion ...