.net-2.0

C# Windows Form created by EventHandler disappears immediately

I don't know why this is happening, but when I create a new form inside an EventHandler, it disappears as soon as the method is finished. Here's my code. I've edited it for clarity, but logically, it is exactly the same. static void Main() { myEventHandler = new EventHandler(launchForm); // Code that creates a thread which cal...

Ironpython console disappears instantly

I installed ironpython 2.0 in the windows xp professional box and it requires .Net framework 2.0 service pack 2 or later. The windows box has it. But still the console disappears. There is issue in either of them. Need help? ...

Does the .NET 3.0 SP1 installer also install .NET 2.0 and 3.0?

.NET 3.0 "wraps" .NET 2.0 so if I'm starting out with a clean Windows Server 2003 environment, will the .NET 3.0 SP1 installer also install .NET 2.0 and 3.0? What about .NET 2.0 SP1? Assume I don't want to install .NET 3.5 SP1 just yet. ...

ListBox select all items

Hi, I need to select all items in a listbox when a checkbox is clicked. Is it possible to select all items in the listbox using a single line of code? Or will I have to loop through all items and set selected to true for each one of them? Thanks :) ...

Unable to change the gridview column width programatically

Hi, On my windows form, I need to programatically set the width of columns in the grid view. I am using the following code: this.dgridv.Columns[columnName].Width = columnWidth; The above stmt runs without any error. But, the column width remains unchanged. If I insert a breakpoint and check the value of width after the stmt runs, it i...

Button on click method entered on page refresh!

Hi, I have a .net 2.0 application and I can't work out why a button's onclick method is run on page refresh. The exact scenario when this happens is a checkbox is ticked against each item the button is clicked and the onclick mthod processes this item, and the checkbox is cleared. Now when the page is refreshed for some reason the oncl...

.NET Generic Parameters for Generic Lists

Running .NET 2.0, I have a generic method with the following signature: static listType FillCollection<listType, objType>(IDataReader dr) where listType : ICollection<objType>, new() it's purposes is to translate a datareader into a collection of objects both of my choosing. My problem, which isn't exactly a problem, is that when I c...

How can I get System.Type from "System.Drawing.Color" string

I have an xml stored property of some control <Prop Name="ForeColor" Type="System.Drawing.Color" Value="-16777216" /> I want to convert it back as others System.Type type = System.Type.GetType(propertyTypeString); object propertyObj = TypeDescriptor.GetConverter(type).ConvertFromString(propertyValueString); System.Type.GetType("...

.NET Add-in to get Project that is being built

Hello. I've created a .NET Add-in that is supposed to do something when a project is being built. I know there are several ways to build a .NET project a) Hitting F5 button b) From Build menu c) From Debug menu ( by debug-ing ) d) By building the solution ( builds the project checked for 'Build' in solution properties ) e) By right-clic...

Determine version of SQL Server from ADO.NET

Hi, I need to determine the version of SQL Server (2000, 2005 or 2008 in this particular case) that a connection string connects a C# console application (.NET 2.0). Can anyone provide any guidance on this? Thanks, MagicAndi Update I would like to be able to determine the SQL Server version form the ADO.NET connection object if poss...

Gridview column sizing in edit mode

Hi, Is it possible to specify a size for the grid view cell when it is in edit mode. The size should be in terms of letters (like we have maximum size for a text box) and not in pixels. My requirement is that user should be able to input not more than 100 characters in the cell when he is editing it. I want to avoid validating after the...

Storing string values as constants in the same manner as Enum

I know there is a way to make enum work for string types with conversions galore - the code doesn't look pretty. Does anyone know of any way to have something like this: public SOMESTRUCTURE SessionKeys : string { value1 = "value1key", value2 = "value2key", name = "name" } so later in my code I could refer to it as: ...

Force Windows to show a system tray icon

This is a pretty stupid question, but here goes: Is there a way (in .net) to force Windows to show your system tray icon instead of hiding it? I don't want to do this all the time, but at least for the first time my application is run I would like it to be visible in the system tray. ...

Does Visual Studio 2010 Beta support .NET 2.0 projects? What about SQL 2005 DBs?

Does Visual Studio 2010 Beta support .NET 2.0 projects? What about opening SQL 2005 *.ndf files with the new IDE? (meaning mdf files included in the project like App_Data DBs in web applications etc.) ...

Finding equality in items in two lists of differing types

I have two objects that are derived from same the base class. Lets say ObjA is the base class, and ClassB and ClassC inherits ObjA. If I have a dim lst1 as List(Of ClassB) dim list2 as List(Of ClassA) and and I want to check for the existence of something being in lst1 that it is in list2, now I am only interested in comparing ...

C# List<> Order with 3 properties .Net 2.0

Hi, Say I have a Person class with Name, Age, Level properties. I know how to order by one of the properties, with PersonList.Sort(delegate(Person p1, Person p2) { return p1.Name.CompareTo(p2.Name); }); But how can I order by Name, Age and Level. An equivalente of the sql sentence : ORDER BY Name, Age, ...

.NET client getting "not well formed" XML response from Axis web service

I have a simple .NET app that makes a SOAP call to a third party Axis web service. When I trace the HTTP traffic, I see that the Request looks fine, however I'm getting an exception: "Response is not well-formed XML." The return object is null, as it seems the XML can't be deserialized. One question regarding the various namespace decla...

ASP.NET 2.0 application won't compile when adding a Microsoft Report to the solution

I have a ASP.NET 2.0 web application. To that solution I add a Report (Reporting Services). I make no further changes to that report. When I try build the application the build fails with the following error originating from that report file : A namespace does not directly contain members such as fields or methods ...

HtmlForm.Action and .Net Framework 2.0/3.5 Query

Disappointingly, the members page for HtmlForm 2.0 is missing... My research seems to indicate that HtmlForm.Action is a property that was added in .Net Framework 3.5. However, I'm using VS2005 and my reference to System.Web (the namespace HtmlForm is under) is to a .Net Framework 2.0 runtime version. Further, my IIS status informatio...

Regular Expression sub-expressions

I'm working on a regular expression (in .Net) that needs to mark subexpressions. Sample inputs are: EFBCFEyy EFBQFEyyQ EFBQFE yy Q EFBMFEyyMM EFByyMFEMM What I need is to pull out all of the sub-expressions delineated by "yy" or "MM". The expression I've got so far works for the first few strings, but not the final pair. There may be...