.net

resize and adjust form controls as per the form resize

Hi All, I am developing a sample windows application. In this application, I am making use of WinForms with FormBorderStyle set to sizable. Now, when I run my application, it shows the startup form which is re sizable. This form consist of various windows controls on it. My problem is, when I resize the form, the controls on it do not ge...

Advertised package not installed on the client in SCCM 2007

Hi guys, I am not sure if this forum is the right place to ask SCCM queries. I have created a tiny environment with one Domain Controller which has SCCM 2007 site server installed. There is one client Vista machine which is connected to it on the same domain. The SCCM client has also been installed on that machine. The problem is, I hav...

Change icon's format in C# Designer?

How do I change the icon PictureBox shows? The icon itself has multiple icons in it with different formats but for some reason the 16x16 is always used. How do I change that? e.g. 32x32 , 48x48 ...

Winforms showing contents of large file

What would be the best way to show the contents of a large text file to the user using Winforms? Right now I've tried a multiline Textbox, but this is rather slow for a 2MB file. ...

Get Groups From OU using DirectoryServices.AccountManagement

Hello, I'd like to use AccountManagement to list all the groups in an Organizational Unit. The following snippet works with DirectoryServices but I would have to instanciate GroupPrincipal with the DirectoryEntry path in the result (which feels like a dirty fix). DirectoryEntry root = new DirectoryEntry("LDAP://OU=Marketing,OU=Operat...

Design-time moving of a child control owned by a composite user control

Hi, I have a Windows Forms user control, which (for various reasons irrelevant to this issue) are exposed in the designer, much like the panels in a split panel. Most everything works nicely, except for dragging the control. The child controls are created by the user control, and it does not accept new children. The intent is only to al...

Why .NET XML API doesn't protect me from null character?

My application receive strings from outside and construct an XML document string fromOutside = "\0"; XAttribute a = new XAttribute(fromOutside); when the attribute value contains null character then I got exception when trying to save XML to the disk (when it goes into XmlWriter) System.ArgumentException : '.', hexadecimal value 0x00...

Is there a way to have a SqlConnection that will write while an associated DataReader is open?

Or what's the recommended way to read and write at the same time? Having two connections open is the only way? This is on a plain Windows Forms C# (.NET 3.5) app using (SqlConnection conn = new SqlConnection(connStr)) { SqlCommand cmdRead = new SqlCommand("select stools from foo", conn); SqlDataReader rdr = cmdRead.ExecuteReader...

Dialog doesn't display properly because of a loop after using .Show() method in C#

I am sorry if it seems like I am posting the same question. The problem is similar but I find out more and more about the problem each time. So thanks in advance for all the help. Its much appreciated. :D I want to show a form/dialog given a certain condition while inside of a loop. My problem is I have created this segment of code in m...

Scraping a Facebook App for Data

I'm using a Facebook application that has a rich set of information that I'd like to get at offline. To do this, I essentially need to read the infromation from the web pages into my own database. Obviously, I'd prefer not to have to save pages manually and let my application read the pages and pull the relevant details from them. Unfort...

character based file stream in .NET

I need to modify a textfile of unknown encoding in that I need to insert some text after the first occurence of a predefined string (e.g. "#markx#"). Is there a class in .NET that allows me to randomly access the content of a file but based on characters (as opposed to bytes). Since the Stream.Seek Methods work on byte basis I would not ...

Populate DataGridView from a Stored Procedure

Using SQL Server 2008 I created a Stored Procedure called MyStoreProc and it runs fine from the Management Tools. In VB.Net 2008 I created a new dataset and a new TableAdaptor. In this table adapter I created a new Query called FillByGrid and selected the Stored Procedure. Previewed data and it previewed correctly. On a form I create...

Shutting down worker threads gracefully

I don't understand why in this implementation stopped is not volatile - If a different thread updates this will it be reflected correctly? Secondly is testing (!Stopping) atomic? using System; using System.Threading; /// <summary> /// Skeleton for a worker thread. Another thread would typically set up /// an instance with some work t...

Reading in files that contain specific characters in C#

I have a text file named C:/test.txt: 1 2 3 4 5 6 I want to read every number in this file using StreamReader. How can I do that? ...

maximum height-based Graphics::MeasureString?

hi all how could one write a version of Graphics::MeasureString(String, Font, Int32) that takes a maximum height instead of width? the reason behind this question is that i have a label that i would like to resize to a specific height, and have the contained text automatically re-flow to take up as little horizontal space (there is a m...

7-Zip Problem for windows mobile

Hi, i am trying to build the 7zip code, which i can use in my windows mobile project.. does any one know how to build 7zip code and use the same in windows mobile application.. ...

What exception should be thrown by a .NET program if it encounters invalid data?

Consider the following example: as part of configuration for my program the user supplies an XML file which should in essence describe an acyclic graph, but my program finds a graph when loading it. This is a critical error, the program cannot continue. What exception should be thrown? Other examples include trying to load a file in som...

Command Binding in hierarchical datatemplate

Hello! I have Menu in my app. I'm visualizing it using hierarchical data template: <MenuItem Header="Main menu" ItemsSource="{Binding ApplicationMenu}" > <MenuItem.ItemTemplate> <HierarchicalDataTemplate DataType="{x:Type tm:RMenuItem}" ItemsSource="{Bind...

serial port close hangs in compact frame work 3.5

I have developed the application for windows mobile 5.0 and .net compact framework 2.0 sp2. This application communicates to the hardware device using serial port. This application works fine in windows mobile 5.0 based PDAs. I have handled data received event to get the data from serial port. But when I run my application on windows mo...

c# .net - authentication expiring prematurely

I am setting up the authentication cookie in c# as persistent and with an end date of one year from now, but it expires not too long after being set. The code is below... DateTime endDate = new DateTime(); endDate = DateTime.Now.AddYears(1); FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, ...