.net

Pinning an updateble struct before passing to unmanaged code?

Hi I using some old API and need to pass the a pointer of a struct to unmanaged code that runs asynchronous. In other words, after i passing the struct pointer to the unmanaged code, the unmanaged code copies the pointer and returns immediately. The unmanaged code can access that struct in background, in another thread. I have no contr...

Creating a class for JSON deserialization

Consider the following JSON: { "Code": 2, "Body": { "Dynamic-Key": { "Key1": "Val1", "Key2": "Val2" } } } Defining the following classes structure: [DataContract] class JsonResponse { [DataMember] public string Code { get; set; } [DataMember] public JsonResponseBo...

How to re-write this inner join subquery from SQL to Lambda

SELECT ulcch.ID, ulcch.UserLoginHistoryID, ulcch.StatusID, ulcch.ClientModuleID, ulcch.DeviceState, ulcch.UpdatedAt, ulcch.CreatedAt FROM UserLoginClientConnectionHistory AS ulcch INNER JOIN (SELECT MAX(CreatedAt) AS maxCreatedAt FROM UserLoginClientConnectionHistory AS ulcch1 GROUP BY UserLoginHistory...

Capture a part of a string that does not match another group (C# Regex)

Hello. I am working on a project that requires the parsing of "formatting tags." By using a tag like this: <b>text</b>, it modifies the way the text will look (that tag makes the text bold). You can have up to 4 identifiers in one tag (b for bold, i for italics, u for underline, and s for strikeout). For example: <bi>some</b> text</i>...

WinForms Different DPI Layouts

Somehow forms and controls created through Visual Studio and the designer have the great ability to scale themselves depending on the current DPI/font size of Windows. One portion of my UI is a tab control full of dynamic pages and labels/inputs generated depending on the user's selection. When these are created, they use hard coded size...

Can't get Value from ComboBox

Hey, I have a simple comboBox with some Value/Text items in it. I have using ComboBox.DisplayMember and ComboBox.ValueMember to correctly set the value/text. When I try to get the value, it returns an empty string. Here's my code: FormLoad event: cbPlayer1.ValueMember = "Value"; cbPlayer1.DisplayMember = "Text"; SelectIndexChanged o...

Multidimensional Collections for a (CS) Graph Class Interface in C#?

For jollies I'm trying to implement a graph data structure as an interface, so that I can implement graph classes either as adjacency lists (lists of lists of edges) or as adjacency matrices ( a 2 dimensional array of edges) with a minimum of additional code. My question is, is there a way I can implement the IGraph interface so that ei...

Cannot run ASP.NET MVC Websites on IIS7

I have Windows 7 professional running IIS7. I have installed ASP.NET MVC 1.0 and VS2008. When I run the app with Cassini it runs fine. When I create a virtual directory and run it on IIS7, the app comes up with a blank web page and no errors at all. How do I get ASP.NET MVC projects running on IIS7? ...

InvalidOperationException - object is currently in use elsewhere

I've gone through this http://stackoverflow.com/questions/246058/system-invalidoperationexception-the-object-is-currently-in-use-elsewhere-ho but it didn't help. The case here is different. I'm using Backgroundworkers. 1st backgroundworker starts operating on the image input of user and inside firstbackgroundworker_runworkercompleted() ...

ASP.NET C# Error: Object Event is undefined

I am getting an EVENT undefined rror in the ASP.NET C# code below. I am dynamically creating image buttons and am explicitly assigning them to a CLICK event. After the user clicks on a thumbnail, the user is directed to a page with a blown up image of that thumbnail. When the user presses the back button to go to the original page thi...

.NET StandardInput Sending Modifiers

We have some legacy software which depends on sending keystrokes to a DOS window and then scraping the screen. I am trying to re-create the software by redirecting the input and output streams of the process directly to my application. This part I have managed fine using: _Process = new Process(); { _Process.StartInfo.FileName = APP...

Serializing object with no namespaces using DataContractSerializer

How do I remove XML namespaces from an object's XML representation serialized using DataContractSerializer? That object needs to be serialized to a very simple output XML. Latest & greatest - using .Net 4 beta 2 The object will never need to be deserialized. XML should not have any xmlns:... namespace refs Any subtypes of Exception an...

c#:How to use enum for storing string constants?

Possible Duplicate: Enum with strings is is possible to have string constants in enum like enum{name1="hmmm" name2="bdidwe"} if it is not so what is best way to do so? I tried it its not working for string so right now i am grouping all related constnats in one class like class operation { publi...

Strong name is must

Is it necessary to provide strong name to an assembly before putting it in GAC? ...

Reliable(durable) distributed logging engine

Trying to find a commercial logging framework for distributed systems. This framework must allow .NET applications on a Remote Server to log messages which can then be collected in a Central Location. If possible the Central Location should store messages in a SQL Server database. Requirements: Be able to initiate the logging of messa...

How do I set a "preferred size" for a form?

I have some controls on a form, and I have them anchored to the left and right of the form to ensure they grow and shrink with the form. My form is also set to automatically grow and shrink in order to accommodate some labels that may get long strings. When those labels get their long strings removed, I want my form to go back to the wid...

How can I download YouTube videos using .NET code?

Does anybody know the VB or C# code to programmatically download a video from YouTube? I have gone through all related questions on this site and the only code I have found (which uses the WebClient Class webclient.DownloadFileAsync) returns the text source of the video, but not the Flash video (.flv) file that needs to be downloaded? ...

Form to object and loop through objects in c#?

I have a main form (frmMain), with some buttons (button1, button2...). then I do this: object objectsContainer = frmMain; // <--now the object contains form base, button1, button2... how could I loop through all containing items in my object to access butto1, button2...??? I did this, but it's not what I want. foreach (PropertyInf...

pling sound .net application

Hello, i have a .net winforms application that i want to be "soundless". occasionally when a user opens a dialog or press enter a "pling" sound appears. how can i disable this on a global scale for my application? ...

hide usercontrol properties from intellisense

hi, how i can hide usercontrol properties from intellisense in vs? ...