.net

Upgrading existing windows applicatioon to .net 3.5 framework

Hi, We have a .net 2.0 windows application already deployed to client machines. Now, we have want to upgrade it to .Net 3.5 framework.But client machines may not have this new framework installed. Can someone please let me know how to achieve this using VS.Net setup and deployment project? Also, after deployment to client machine, whe...

How to use #IF DEBUG in vb.net

Is it possible to assign a value to a class variable from inside a #IF DEBUG conditional? Basically what I want to do is conditionally execute some code from inside my main form load if I am running in DEBUG mode. I thought I would do something like: Public Class Form1 public DEB as Integer #if DEBUG then DEB = 1 #else DEB = 0...

How to detect if an object is within a 'using' scope?

Please see my example code: var testObject = new SomeClass(); using (testObject) { //At this point how can the testObject implicitly know //if it is placed inside a 'using' scope? // In other words, how can testObject know that // .SomeAction() is being called from within a 'using' scope? testObject.someActio...

C#/.NET: Can I get a string of valid HTML from a Stream?

Ok, so I'm rendering a partial view control in memory that generates HTML that I would like to get to a PDF renderer. The renderer only takes a string as an argument. I have a MemoryStream containing the HTML that I need to get to the renderer. This is what I'd like to do: inStream is the MemoryStream of HTML from the partial view. do...

C# I had a confusion

I had a confusion let me explain it in brief. I have a form i placed one textbox and a command button. and I have one plain class. class1 code. class Class1 { string s = "hi"; Form1 form1 = new Form1(); public void cl() { form1.textBox1.Text = s; } } form1 code private void button1_Click(object sender,...

editable combobox and update of the binded observablecollection

hello all, I an a newby and I spent over a day trying to figure it out how to update the observablecollection binded to a combobox. What I would like to do is to edit an item of a combobox, and then when I change the selection have it set as the current selected item and update the collection so that when I open the dropdown I see all re...

<asp:XXXX > vs <%# %>/<%@ %>

I'm starting to learn ASP.NET and going through the tutorial videos on www.asp.net. I understand the basic concept of web application frame works like ASP/PHP/ASP.NET. HTML/XHTML is created with special tags that the server knows to read and replace with content. I did a little bit with ASP during a summer internship back in the 90's. ...

How to validate X509 certificate?

I have to write a tool which validates if a X509 certificate is valid or not (input = cert path / subject and password). How can I do that? I don't know much about certs... ...

how to get stream positions of xml elements in .NET

How can I get the stream position of an XElement in .NET 4 in a reasonably efficient way? 1 2 3 4 5 6 7 8 01234567890123456789012345678901234567890123456789012345678901234567890123456789012 <root><group id="0" combiner="or"><filter id="1" /><filter id="2" /></group></root...

Is there XSLT available for transforming WordprocessingML into RTF

I currently generate docx files programmaticaly in C#. I would like to transform my doc file into RTF. This be done with an XSLT transform. Is there a transform that is publicly available? I am also interested in trasnforming docx into PDF and HTML. ...

Implementing 'only one of' and 'not in parallel' semantics with the Task parallel library

What would be the best approach for implementing Tasks with a KEY that operate as follows:- Option 1) Only one of this key is ever pending. Can be used, for example, from ASP.NET MVC to queue up a single render for a thumbnail image no matter how many times the image Url is hit. Only one runs, all other requests wait for that one to c...

Using the .NET 3.5 Entity Framework how can I save an entity?

I have for example a table called Client. Usually in .NET 4 I would do: dbEntities.Clients.AddObject(myClienteObject); but in .NET 3.5 I cannot find this method, any suggestions? ...

Where does WPF's FontFamily.Source retrieve its value from?

I have two applications that use the same data to create a UI, one is using WPF and the other is using GDI. I'm using a font called Myriad Condensed Web, according to the font name attribute in Windows. I have no problem instantiating the System.Drawing.FontFamily object using the given font name. However, when I create this font using W...

.NET gallery code/manager?

Is there any code i can plugin from .NET? Basically i want to show 160x160images from the web in my app. Then program what it does when i click the image. I need a scrollbar to move through the items. I would like the images to be cached and dont want to write code for it. Is there any snippet or lib i can use to do this? ...

.NET MVC Custom Date Validator

I'll be tackling writing a custom date validation class tomorrow for a meeting app i'm working on at work that will validate if a given start or end date is A) less than the current date, or B) the start date is greater than the end date of the meeting (or vice versa). I think this is probably a fairly common requirement. Can anyone poi...

Is there a no-copy buffer/stream in the C# other than MemoryStream?

Is there a class which, rather than copying data written to it into an internal array which is occasionally resized (as MemoryStream does), retains a reference to each buffer that users pass into it on write, and maintains a data structure which keeps track of each buffer written and the offset/count? It should also support a read mechan...

What would be happen if all static methods would be extension method default ?

Hello everybody Static methods always should to encapsulate arguments by parenthesis . So it is much more easy to use extension methods while typing. That is one of the reason why i like extension methods. I am not sure when time it is better to use extension or static methods. And i am thinking that what would be happen if all static ...

Best Microcontroller for .net ?

What is the Best Microcontroller for .net ? (best = popular, good value, has many I/0, able to get support) ...

Uploading to Imageshack with VB.NET

I want to use the http://www.imageshack.us/upload_api.php API function to upload a picture onto ImageShack and then obtain the image_link. The only problem is, how do you place an image with its file name with the form-data along with the API key? This is what is stumping me in trying to implement the function. By the way, OpenDialog is...

Disposing serial port object

I'm writing a small piece of code that would determine which serial ports on a computer are free for connection. This is done by looping through the different serial ports and calling the Open() method. If an exception occurs, this indicates that the port is unavailable. However visual studios is telling me that I'm not disposing of the...