.net

Maintaining the size of the control which is located on the form when form is resized.

I have one form which size is (325,325) and on which one browser is there and the size of the browser is (321,298) means browser is in the middle of the form.And I want to maintain the size of the browser when form is resized like there should be the same difference of the size between form and browser as it was before resized. ...

Create TCP Packet in C#

I'm sending data to an extremely old system via TCP. I need to send 2000 bytes in one packet, and I need it not to be split up (what happens when I write out 2000 bytes via a socket). While, yes, I shouldn't have to care about this at an application level -- I in fact do care about this, because I have no other options on the older syst...

How to connect to sql-server with windows authentication from windows-service?

I have programmed a Windows Service in C# which should connect to an SQL-Server 2005 Express Database with System.Data.SqlClient. As Microsoft prefers to use Windows Authentication over SQL Authentication I tried to connect to the DB with Trusted Conenction / Integrated Security. However that doesn't work as I get a System.Data.SqlClie...

How to call shell script from net assembly

Need to call unix shell script from a Net assembley, how would I do it.. and return tabular result(key value pair(s)) to the caller. ...

Entity Framework - Detaching entities when ObjectContext disposed?

I'm using the EF in a WinForms app, my idea is to have an ObjectContext per transaction instead of a single long running context. But I'm getting an error when I try to attach objects from a previous transaction into a new one, something to do with the entity already being in another context. I kinda assumed that entities got detached w...

Using IVsSelectionEvents.OnSelectionChanged for with the designer

I'm trying to use IVsMonitorSelection to know when the user is selection a control (label, textbox, etc.) on the designer. So far I get events when the user click on item from the "Solution Explorer" window and when he click on the designer window, but when the focus is already on the designer window and he select another control, there'...

How to scroll a flowlayoutpanel while dragging?

In my Windows Forms application, I'm using a FlowLayoutPanel control to display a list of items to users. I've been able to successfully implement reordering the items in the FlowLayoutPanel by having the user drag the control to the desired position within the FlowLayoutPanel. But I don't know how to scroll the FlowLayoutPanel when ...

How do I populate a listview based on 2 boolean table columns?

Hi, I have a database table containing scripts for plays/dramas. The scripts can be categorized under 'Theatre and Education', 'Plays for Young People' or both (by using bools to determine whether they belong to said categories); scriptID: int theatreAndEducation:bit playsForYoungPeople: bit scriptTitle: varchar scriptSample:text t...

How to position WPF Expander based on Header height?

Hi all! I have been struggling with a problem that at first glance might look easy for quite some time now. The problem in short is that I want to position an expander based on the height of the header in the expander. The long story is that I have a grid with (currently, but that could be easily changed) two rows. At the bottom at the...

Weird installation error in .net

When I deploy my app on other machines, this error comes up: Now if I uninstall my app and re-install it, the error message does not come up. Has anyone else encountered this? I cant make sense of the stack trace either. ...

How can I make my .NET application erase itself?

How can I make my C# app erase itself (self-destruct)? Here's two ways that I think might work: Supply another program that deletes the main program. How is this deleter program deleted then, though? Create a process to CMD that waits a few seconds then deletes your file. During those few seconds, you close your application. Both of ...

c++ fatal error c1083 project was fine before, what now?

I have a (com) c++ project, which uses a (.net) c++ dll. The project was compiling and running ok. Now, all I did was make changes to the dll, and I'm getting a fatal error c1083- cannot open include file stdafx.h - when recompiling my (com) project. What can this mean? ...

Already defined delegate

I heard once that .net introduced an already defined delegate with no parameter that we could use instead of creating one. I'm having a hard time finding it and for what version of .net. (if it really exists) Thanks! ...

C# Split A String By Another String

I've been using the Split() method to split strings, but this only appears to work if you are splitting a string by a character. Is there any way to split a string, with another string being the split by parameter? I've tried converting the splitter into a character array, with no luck. In other words, I'd like to split the string "TH...

How can I make a value passed to a function that runs on a separate thread be changed on the original thread?

Hi, I've created an abstract class which implements a method that runs another abstract method on a seperate thread, like this: public abstract class ATest { Thread t; protected String status; public void Start() { ThreadStart ts = new ThreadStart(PerformTest); t = new Thread...

Are there any .NET based SEO libraries that check inbound links for domains and keyword ranking?

I am looking for a library, either open source or paid, that allows me to check a number of domains ranking for keywords, preferably across multiple search engines. In addition it needs to be able to check the number of inbound links to a site. I know I could write this using the Google API / Yahoo Site Explorer, but I was looking for so...

Exchanging objects between C# and C++

Imagine a project with a C# component and a C++ component. The C++ component is the old-school non .Net stuff (VC++ 6.0). What is an easy way to transfer objects between the two components? I'm tempted to use System.Xml.XmlSerializer, but I'm not sure how to start getting at the .Net libraries with this old VC++ app. Maybe there's an...

Query for Active Directory information via Sharepoint and MOSS

I am responding to events that occur (like adding an item to a list) in SharePoint. I would like the ability to query AD with the triggering user ID and get back some specific information such as Department, Phone Number, Title and so on which isn't included in the SPUser information. Is there a built in way to do this? What is the best ...

Is there a function to generate the filename of a copied file?

Does C# have any functions to produce a new name for a copied item ? For example , if I have a string called "Folder" , I need a function to produce a string "Copy of Folder"....and given the string "Copy of Folder" the function should produce "Copy of Folder (1)" and so on .... ...

Set page size using WIA (with scanner)

Hello, I'm using WIA to acquire images from a scanner with C#. I can scan the papers, but I can't set up the page size correctly, it always defaults to A4 and I need to use Letter or Legal sometimes. I tried with the WIA_DPS_PAGE_SIZE property, but when I try to set a value, I always get an error, that the value is out of the interval (...