Questions for c#


.NET Design View Not Running Windows Forms OnLoad

I have a windows application which works when the application is running, however in design view, the code in the OnLoad event crashes due to a host of reasons. Is there a way to do something like ...

C# - Access array without null exception

I have to set these variables through with the QueryString array:

Help With Overriding and Inheritance

Ok, bear with me guys and girls as I'm learning. Here's my question.

insert multiple xml elements in c#

I want to create XML document with multiple elements inside. The format should be something like this:

how to reference a value in a C# array

i have the following array :

WindowsForms designer and GenericForm

Why doesn't the designer work if you inherit from an own written genericform?

ICollectionView Filter won't refresh - are my bindings wrong?

Beginning to learn C#/XAML, so very well may not have done this the right way.

more than 1 sequence of random numbers c#, linq

i was using this code to generate a random sequence of numbers:

How to stop scrolling of Panel scrollbar when textBox is selected

I have a panel called Panel1 that contains many textBoxes .(around 12 textBoxes)

C#: Load roaming profile and execute program as user

In an application I need to execute other programs with another user's credentials. Currently I use System.Diagnostics.Process.Start to execute the program:

Serializing immutable collections with protobuf-net

I'm trying to serialize a class with protobuf-net which contains an immutable collection as a member.

Piping (multiple) expressions in RegEx

I have a set that varies greatly in general, but I managed to find some similarities. The data may be completely different but they do have same ending classes. I am wondering if it is feasible to ...

How can I get the layers from a PSD file?

I want to retrieve all layers from a PSD file and get their name, X and Y position.

.NET Regular Expressions in Infinite Cycle

I'm using .NET Regular Expressions to strip HTML code.

FTP c# against Solaris 10 server

I am trying this code to download a file from a Windows machine using C# against a Solaris machine and I receive error 550 - File unavailable.

Threading and Incrementing

So I think this might be a fundamental flaw in my approach to threading and incrementing a global counter, but here is my problem. I have a collection of file names from a DB that I iterate through...

What is the meaning of “..::.” in C#?

I saw this signature on the ListView class:

c# datagrid cell extraction

Hey im trying to store a string from a selected item in a datagrid as it has a filepath id like to use to delete.

Add to generic List property and save in viewstate

I'm using a generic List to store a set of data in the viewstate. If I try sorting the list using linq in the get accessor then when I try to add a new item to the list if doesn't work. No error, i...

ToolStripDropDownButton, how to remove all DropDownItems?

How to remove all DropDownItems from a ToolStripDropDownButton, if its propery is read only?

Unit Testing - dependant tests

I am creating a list of unit tests that are dependant on each other. For example, my first test creates a record in the database and checks that the return value is greater than 0.

Receiving Object reference not set to an instance of an object. on simple datetime retrieval from Raven

Not sure why its complaining about this error, but when comparing time stamps to I get a object reference error. Here is the simple code.

Transparent Window in .NET

is there any way that winforms or WPF can do this kind of UI? transparent with blur window.

ASP.NET 2.0: How to make a page remember viewstate without creating history points?

I have a page with a few fields and a runtime-generated image on it. The contents of this page are inside an UpdatePanel. There is a button to take the user to a secondary page, which has a button ...

How to compare two date time in c#

I want to find if difference between DateTime.UtcNow and LastEdited(9/11/2011 21:00:00) is lesser than 30 minutes, so the bool should return a false since the difference is higher. But it returns t...

Does ViewData have a maximum length?

I'm storing my HTML in a database so the page loads the HTML data from the database. I use ViewData in my ASPX page in order to populate the page. The HTML is stored in a NVARCHAR(MAX) column and...

Border will not show in WPF Control

I'm trying to programmatically set a border in class that is derived from System.Windows.Controls.Control.

Using async/await for multiple tasks

I'm using an API client that is completely asynchrounous, that is, each operation either returns Task or Task<T>, e.g:

adding files to listview in C#

I have a Listview and an "ADD" button,when I click on ADD i should be able to browse the files in computer, select files and when click OK or the Open, the file list should be added in the

Can Mono create/run reports in rdlc?

I've never used mono and was curious if mono can create/run rdlc reports? What I'm looking at implenenting is a mono mvc app to use a rdlc to create a report and export to pdf. Is this poss...

GetState.IsKeyDown() never returns true (Microsoft.Xna.Framework.Input.Keyboard)

I am trying to check if a key is pressed on the keyboard with Xna.Framwork.Input, but the method i use doesn't see to work.

How to Calculate the Square Root of a Float in C#

How can I calculate the square root of a Float in C#, similar to Core.Sqrt in XNA?

I didn't close previous DataReader, but where?

I have changed my previous code so I am not using 'using'. It work earlier, and code in different class basically represent the same thing, but its working.

On which Page life cycle are the Client IDs generated?

i am programatically adding Webcontrols in to a User Control i am also adding a javascript event passing the controlID as a parameter but the clientID is the one i assigned a it does not contain th...

how do i write assembly code from c#?

i want to write a string of assembly code in c# and have it sent to some win32 api to compile and execute it and get the results back.

IBM WebSphere MQ - how do I read only MQMT_REQUEST messages

I'm developing windows service that serves two purposes.

Why cant I create a generic list of my class type?

public partial class About : System.Web.UI.Page

jQuery ajax json webservice error

If someone could point out what's wrong here I would certainly appreciate it. I can set a breakpoint in the webmethod and it gets hit, but it always errors out.

Intercepting and hiding a window before it appears

I am developing a (in-process) plug-in to application and as part of my plug-in I want to replace the application's tool-tips with my own. However, there is no API available for me to do so, so I've

Change file name <AssemblyName.exe.config> to <App.Config> for output directory in Visual Studio

I have a C# project and an App.Config file in this project. When i build the source code, a file (AssemblyName.exe.config) is created in the output directory for the application configuration but i...

How to access the notes field on a GroupPrincipal object

I query all security groups in a specific domain using

File.Copy target file is a directory, not a file.

I am probably not doing this correctly, and browsing the MSDN library hasn't helped me much. I am trying to copy my database from my project folder to another location. I initially tried the deskto...

What are some different methods to drag and move objects around without using Horizontal or Vertical Alignment set to Left and Top

I am developing a Dashboard application where I would like the user to be able to resize and move their chart widgets to where they please. I have had problems with the being able to move and resiz...

How to update C# hashtable in a loop?

I'm trying to update a hashtable in a loop but getting an error: System.InvalidOperationException: Collection was modified; enumeration operation may not execute.

C# for Windows Phone 7, why this language

I'm trying to find a concrete arguments, why C# was chosen for Windows Phone platform?

Rebind Single row

I have a .NET 4 WinForm application. I have bound a DataGrid to a collection of objects via a BindingSource. I then modify one of the objects. The grid is smart enough to recognise this once I cl...

adding controls to a panel , positioning the from left to right

i would like my added user-controls to be added in html-positioning way: I want them to position automatically from left to right and when there is no more room on that 'row' , to continue from the...

C# - closing Sql objects best practice

If you have a C# function with Sqlaccess, is it mandatory to close all objects/handles, or is everything cleaned up automatically once you exit the function

Does Serializable transactions only lock out other transactionscope statements? or everything?

In a transaction i have the following, MyEntities is my context:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.