Questions for c#


9319

.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 ...
6942

C# - Access array without null exception

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

Help With Overriding and Inheritance

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

insert multiple xml elements in c#

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

how to reference a value in a C# array

i have the following array :
219

WindowsForms designer and GenericForm

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

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.
9202

more than 1 sequence of random numbers c#, linq

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

How to stop scrolling of Panel scrollbar when textBox is selected

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

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:
6201

Serializing immutable collections with protobuf-net

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

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 ...
9428

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.
3385

.NET Regular Expressions in Infinite Cycle

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

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.
4402

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...
1868

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

I saw this signature on the ListView class:
3632

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.
2129

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...
3760

ToolStripDropDownButton, how to remove all DropDownItems?

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

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.
6258

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 DateTime.now I get a object reference error. Here is the simple code.
4625

Transparent Window in .NET

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

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 ...
3441

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...
369

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...
8412

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.
7275

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:
6920

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
8757

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 asp.net mvc app to use a rdlc to create a report and export to pdf. Is this poss...
2675

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.
8811

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?
8096
7448

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.
9257

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...
9480

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.
1902

IBM WebSphere MQ - how do I read only MQMT_REQUEST messages

I'm developing windows service that serves two purposes.
9554

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

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

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.
1828

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
789

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...
4122

How to access the notes field on a GroupPrincipal object

I query all security groups in a specific domain using
7308

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...
1631

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...
9599

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.
9196

C# for Windows Phone 7, why this language

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

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...
8978

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...
3912

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
4291

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

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