Archived Months
June 2003
July 2003
August 2003
September 2003
October 2003
November 2003
December 2003
January 2004
February 2004
March 2004
April 2004
May 2004
June 2004
July 2004
August 2004
September 2004
October 2004
November 2004
December 2004
January 2005
February 2005
March 2005
April 2005
May 2005
June 2005
July 2005
August 2005
September 2005
October 2005
November 2005
December 2005
January 2006
February 2006
March 2006
April 2006
May 2006
June 2006
July 2006
August 2006
September 2006
October 2006
November 2006
December 2006
January 2007
February 2007
March 2007
April 2007
May 2007
June 2007
July 2007
August 2007
September 2007
October 2007
November 2007
December 2007
January 2008
February 2008
March 2008
April 2008
all groups > c# > april 2008 > threads for tuesday april 1

Filter by Day: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

Get data of internal data representation of primitive type
Posted by Jon Slaughter at 4/1/2008 11:42:21 PM
Is there a way to collectively get the internal data for primitive types? So for Int32, SByte, etc, I want to be able to get the byte stream used for the data. The reason is that I want a byte stream of the values but I don't want to convert each one by hand(I started but its getting messy)...more >>


Windows Console App Align
Posted by Fernando Rios at 4/1/2008 11:04:01 PM
Hi, I'm a rookie about C# and im starting developing some Basic Console Aplications, but i was just wondering if there's a way to center a message when using the "Console.WriteLine("");" command, lets say i want the message to appear centered when running the program. Thank you so much! ;)...more >>

Problems creating collection properties
Posted by Andy B at 4/1/2008 11:03:43 PM
I am trying to create a property of a class that holds a collection. Inside the main class is a property that is defined as a collection. When I try to assign values to it I keep getting all sorts of errors. The main one that I get now is 'Can't convert Contracts.ContractModel.ContractDefiniti...more >>

DataGridView Button Text
Posted by Saimvp at 4/1/2008 10:30:01 PM
Hello and Gud Day. I have a simple problem but I can't solve about the DataGridViewButtonColumn. How can I show my Caption in DRV button. Theres 2 way. 1. In the Design View. I set all the necessary needed like the " UseColumnTextForButtonValue = true; " 2. Thru run time. Below is my ...more >>

Default accessors in Collection classes
Posted by Andy B at 4/1/2008 8:52:11 PM
I have a class called ContractDefinitions which is a property of another class. It is a collection of Definition types. When I created an instance of ContractDefinitions and added 2 Definition objects to it, The compiler complained telling me that I had to create a default accessor for the C...more >>

events and backgroundworker thread
Posted by Analizer1 at 4/1/2008 7:56:30 PM
Hi ... I have lets say 4 backgroundworker thread running they all connect to sqlserver2005 does some processing where im having problems..its on critical errors lets say the sqlserver is down.. so tons of errors are kicked off , where as i catch them at different places in the code, try/ca...more >>

How to use Intptr as BYTE* or HANDLE*
Posted by Mariam at 4/1/2008 7:39:00 PM
Hi all I have a question about Intptr and how I can use it I have a C++ code which do the following: DWORD nBufferSize = 0; BYTE *pBuffer = NULL; hr =GetInfo(&nBufferSize, &pBuffer, NULL); to use the function GetInfo in C# I have to pass the parameter pBuffer as Intptr, I don't kno...more >>

select a database as the DataSource
Posted by Tony Johansson at 4/1/2008 7:35:26 PM
Hello! I use VS 2005. A Datasource can be a Database, Web Service or an Object. So I select Data->Add New Data Source in the menu. In the dialog data Source Configuration Wizard I choose Database. When being asked about Choose Your Data Connection I click New Connection. In this dialo...more >>



GetFields not working?
Posted by Jon Slaughter at 4/1/2008 7:06:18 PM
FieldInfo[] fields = type.GetFields(); works and returns all public fields, but when I do FieldInfo[] fields = type.GetFields(BindingFlags.Public); I get nothing!! Whats going on? (again, its that simple... if I delete BindingFlags.Public I get all public fields but if I don't then I ...more >>

strange behavior from Regex.Split & myString.IndexOf
Posted by mad.scientist.jr@gmail.com at 4/1/2008 5:55:16 PM
I am working in C# ASP.NET framework 1.1 and for some reason Regex.Split isn't working as expected. When trying to split a string, Split is returning an array with the entire string in element [0] and an empty string in element [1]. I am trying two different ways (an ArrayList and a string arra...more >>

Newbie GridView question
Posted by Durango2008 at 4/1/2008 4:27:42 PM
Hello I have a form that uses a Gridview to display data obtained from the database. The problem I am having is that the data I receive is tremendous amount of text. Each cell basically gets elongated vertically and hence the page streches due to this large amount of data. My solution is to cr...more >>

Need to extract the Click event from tsMenuItem.Events
Posted by AAaron123 at 4/1/2008 3:26:42 PM
newItem and tsMenuItem are ToolStripMenuItems. I'd like to add the click event in tsMenuItem to newItem. Can't do this because Events is Protected: newItem.Events.AddHandlers(tsMenuItem.Events); Can't do this because Click must be on the left side: newItem.Click += tsMenuItem.Clic...more >>

Concat two Dictionary<>
Posted by Peter Larsen [CPH] at 4/1/2008 3:00:44 PM
Hi, How do i concat two dictionaries aka the following sample: Dictionary<int, string> a; Dictionary<int, string> b; b.Add(a); What is the easiest way to concat two dictionaries ?? BR Peter ...more >>

Handle of a Bitmap
Posted by Sumit Rajan at 4/1/2008 2:57:44 PM
Greetings, If I created a bitmap using: Bitmap b = new Bitmap(50, 50); And if I needed to get the handle associated with this bitmap (hWnd, I need to do this because a function that I cannot touch requires it), how should I go about doing this? I would be extremely grateful if someon...more >>

copy folder from source to Destination in backgroundworker
Posted by Bruce Reiland at 4/1/2008 2:49:25 PM
I'm new to all this, and have been having a problem with using the backgroundworker. I have a form with textboxes & a folder browser that are used to set a string called Sourcee, and Destination. on this form I have a button to call the copyfoulder class and copy from source to destination. co...more >>

Newbie question on string operators in C#
Posted by Richard at 4/1/2008 2:09:33 PM
Can anyone help a VB programmer understand the following C# code snippet please? This is excerpted from a base conversion function that converts s (a string representing a number in any base 2 to 36) into a string representing the number in another base. if (s[i] >= 'A' && s[i] <= 'Z') { fs...more >>

simple way of continuing out of outter loop
Posted by Jon Slaughter at 4/1/2008 2:08:46 PM
Say I have two nested foreach loops, is there any simple way of continuing out of the outter most loop depending on what happens in the inner most? e.g., foreach(int i in I) { foreach(int j in J) if (j == 3) break.continue; } where break.continue means break o...more >>

Linq-SQL canonical editable datagridview sample code
Posted by Andrus at 4/1/2008 12:46:31 PM
I'm looking for a WinForms Linq-SQL editable DataGridView sample which performs insert, update, delete on entity list returned from Linq-SQL query and saves changes to database. Where to find such sample code ? Andrus. ...more >>

bitmap is the wrong color
Posted by Steve Richter at 4/1/2008 12:36:40 PM
using SetPixel to set all the pixels of a bitmap to Color.Red. Problem is the bitmap displays as Color.Turqoise. if all the pixels of the bitmap are Red, why does it not display as Red? thanks, Bitmap bm = new Bitmap(5, 12 ); // set the bitmap pixels to color.Red for...more >>

WriteXml not working , help
Posted by paolol at 4/1/2008 12:20:58 PM
Hi, I'm tring VS2008 with a simple Windows program, just a grid and a db made of an XML file. All work fine until the 3th record then the dataSet1.WriteXml("pippo.xml"); don't write the new inserted record, but don't give any error. The only way do make it working is to edit a record and t...more >>

SQLDataReader and the length of a string field
Posted by Dom at 4/1/2008 12:15:05 PM
I use SQLDataReader to obtain data from a SQL Server backend. Within the program, I need to know the length of some of the varchar fields. Not the length of the returned value, but the maximum length, as it is specified in the database. How do I do this? I'm expecting something like this: ...more >>

XMl Linq question
Posted by CSharper at 4/1/2008 11:52:46 AM
I am trying to find a first element from an xml file using the following code XElement t = xml.Descendants("Element").First(); This works fine, but when there is no result set ofcourse the first method call bombs. I can always split the statement into two and check if there are any elements a...more >>

Common Function?
Posted by at 4/1/2008 11:48:53 AM
I have a common function (private void createDocument()) that I use in many pages within my asp.net app. This function is coded into all of these pages. What advise would you have to have this function only once in the app and called from all applicable pages? Does it need to be in a .cs fi...more >>

problem in defining a generics
Posted by m.a at 4/1/2008 11:37:01 AM
Hello, I am developing a class which needs to do some mathematical processing. I like to develop it in a way that it accept double or float or int based on the user requirement so I defined it as a generic as follow: public class MyClass<T> { T pi = (T) 3.141592...more >>

UDP Broadcast datagrams sent and received on same computer.
Posted by riaancillie@gmail.com at 4/1/2008 11:35:50 AM
I apologize in advance since this isn't strictly the most appropriate group to ask this question in. I am using a Socket to broadcast UDP datagrams as such: FSocket.EnableBroadcast = true; FSocket.SendTo(bytes, new IPEndPoint(IPAddress.Broadcast, 9991) ); I receive the datagram on the oth...more >>

Non Virtual method using CodeMemberMethod -- CodeDOM
Posted by Abhi at 4/1/2008 10:59:01 AM
I am using CodeDOM namespace to dynamically generate code in C#. But when I am creating method using “CodeMemberMethod” then its creating a virtual method even though I am not specifying anything to create a virtual method. I am using following code to add method: CodeMemberMethod testM...more >>

Sending XmlDocument to IE
Posted by John at 4/1/2008 10:10:00 AM
Hi, I develop windows applications. I have a XmlDocument that is dynamically created in the memory, and I have a .xsl file that is stored on the disk. I need to display the xml data in IE. How can I launch IE with XmlDocument object? Thanks....more >>

C# and VC6 Web Services File Upload
Posted by Chizl at 4/1/2008 10:09:18 AM
I'm cross posting, sorry, but this pertains to both sides.. I have a Web Services written in C# and a client written in VC6. I've never uploaded files through web services so forgive my ignorance in this matter, but I'm trying to understand how I can do this from the C++ client. The C# c...more >>

Add a clone property to the ToolStripMenuItem?
Posted by AAaron123 at 4/1/2008 9:58:52 AM
There is some code that can be found by googling "dirt simple clone" for cloning a ToolStripMenuItem. It's quite old. Posted by Ron of the .NET Client Team in 2005. I don't see how that helps because I don't know how to convince the Designer to use that type instead of the regular ToolStrip...more >>

ASMX Json Serialization in 3.5 Framework.
Posted by batham at 4/1/2008 8:29:12 AM
I created a asp.net web site with a web service in it. My web service returns a object "Person" which is serialized into JSON, when I make a ajax call to this service this is my return output. {"d":{"__type":"Person","FirstName":"Foo","LastName":"Goo","Age": 99,"Address":{"Street":"One Micr...more >>

Specify precision of decimal?
Posted by Anodes at 4/1/2008 8:19:13 AM
I have a decimal variable. I'd like it to store a number rounded to two decimal places. I've declared and loaded it like this: CODE private Decimal FileSize_MB_DataFile = 0.0M; this.FileSize_MB_InitialFile = Convert.ToDecimal(fileInfo.Length) / 1048576; //1024 x 1024 I want the actual v...more >>

textbook authors: passing by ref is NOT more efficient!
Posted by Aaron Watters at 4/1/2008 7:26:38 AM
Hi. I've been teaching C# and I'm tired of students telling me that they passed ints by ref when they don't need to because it's "more efficient". I've seen this myth repeated in many textbooks, but it's completely wrong in C# (and it's always wrong for ints in any language). In the case of...more >>

Linq & List.Contains
Posted by Andy at 4/1/2008 7:11:41 AM
Hi, I'm trying to add a where clause to my query: List<string> types = new List<string>(); types.Add( "A" ); types.Add( "B" ); query = query.Where( c => types.Contains( c.Type ) ); When executed, I get the following exception: System.NotSupportedException : Queries with local collecti...more >>

Delegate Equal() returning false when it shouldn't?
Posted by Israel at 4/1/2008 7:09:29 AM
I've run into this odd issue that I've never seen before. I have code that has worked fine for a few years using .NET 1.1 and then when we switched to .NET 2.0 it started not working. There were no code changes related to this class or anything uses it. I have a class which has a data member...more >>

Windows Mobile Soft Input Panel options disable.
Posted by PNav at 4/1/2008 6:14:00 AM
Task: To disable the SIP menu's "Options..." sub menu item on PocketPC 2003, Windows Mobile 5.0 PocketPC and Windows Mobile 6.0 Professional. Solution: The application has been created using C# as a smart device application. We have used PInvoke wherever Win32SDK APIs have been called. We ...more >>

how i should solve slash / problem
Posted by TalalSaleem at 4/1/2008 5:51:05 AM
if i put slash("/") at the end of url then .aspx page couldn't load the css and images. example: http://testURL/TestPortal/test5/test16.aspx/ after / insert at the end of url website will loose its formattings and its images.....more >>

LIstbox in Web aplication
Posted by Midger at 4/1/2008 4:58:50 AM
I've found a trouble with using Listbox cortrol in Web application. I've used it previously and all works good. I can get which elements are selection. for (int nrp = 1; nrp < lbWorker.Items.Count; nrp++) { if (lbWorker.Items[nrp].Selected) ...more >>

if i put slash("/")at the end of url page couldn't load .css & ima
Posted by TalalSaleem at 4/1/2008 4:50:00 AM
if i put slash("/") i mean just a / at the end of url then .aspx page couldn't load the css and images. i have a portal in .net if any body puts / at the end of url that page couldn't load the css and images. example: http://testURL/TestPortal/test5/test16.aspx/ after / insert at the en...more >>

Verbatim String or Regex Pattern from Input
Posted by Aaron at 4/1/2008 3:08:07 AM
Hi, I'm having a tricky problem where I want to accept a regular expression pattern from user input but can't get teh escape characters to be prcoessed correctly. If I take the same pattern and declare it in code with a preceeding @ character it works fine. To get the pattern to work fro...more >>

How to read ACLs in AD with dotnet managed C# ?
Posted by Christian from France at 4/1/2008 12:54:01 AM
I want to do the folllowing in C# : I have a DirectoryEntry : DirectoryEntry usr = new DirectoryEntry("LDAP://cn=Mike,ou=Users,dc=MyDc"); With "AD Users & Computers" Security tab an administrator had give to some users the right to write the accountExpires property of this Account. I want to...more >>


DevelopmentNow Blog