.net-3.5

How can I see if a network connection changes state?

I am writing an application that checks if the computer is connected to one particular network or not, and does some magic for our users. The application will run in the background and perform the check if the user requests it (menu in tray). I also want the application to automatically check and do magic if the user changes from wired ...

ControlPaint.DrawBorder().....but thicker!?!?

I have the below code, which works, to draw a border around a control in a WinForm 3.5 app. What I can't figure out is how to THICKEN the border that is being drawn. I tried Inflate(5,5) on the ClientRectangle but that actually made the Border disappear all together versus making it thicker. I get the impression that I actually need...

NullReferenceException after turning ascx UserControl into reusable server control using Microsoft's tips

A supposedly proven technique to turn UserControls of a website into reusable server controls while retaining the ability to use declarative code gives me a NullReferenceException on any reference of any control that's declared inside the ASCX code. When calling the ASCX from the same project, this problem does not occur. The idea is t...

Control Docking Rectangle inside of a Panel

I have a panel that renders a special header, this works all fine and good - but when I dock other controls inside of that panel, they size to fit underneath the header. My thought was to try and catch this and control it somewhere. Getting the DisplayArea doesn't work - then the header doesn't draw in the right place. Is there any way...

Secure data type to store password in a VBA.NET forms app in Systems.Setting

Need to store the username and password for an outside application inside of a windows forms vb.net app. For initial testing, I just set the settings type to "Text", but want more security. There are System.Security and Encryption types available, but not sure where to begin. Any suggestions on how to Add, Update, and Delete the values...

best approach for multithreaded server on .net?

Hi , I want to develop a server which will listen on some specific ports to receive requests from device.While processing a request following steps are followed. Read data from socket stream(sent from device) Parse byte data in to business objects Use business objects process request using database through ado.net layer Send response i...

How to bind to a Textbox

Hi, my XAML is <TextBox Name="DutchName" HorizontalAlignment="Right" Text="{Binding customer,Path=DutchName }" /> my class is class customer { Name name; } class Name { string DutchName; string EnglishName; } The textbox is not binded. Any one correct the error plz. Thanks, ...

Nullable Generic Declaration?

Hi, Say I have an object, Class A<T, T2> { public T MyObject {get;set;} public IList<A<T2>> MyChildren {get;set;} } Problem is, sometimes I dont have children, so I dont want to declare the children type aka T2, any idea? I cannot pass in like A a = new A<string, Nullable>(); as it is throwing an error. Thanks ...

Check for entered text in WinForm App

I have a WinForm App(.Net 3.5) that we use in house for data entry...ish, like things. Member Plans, Demographics, etc. The App has a Shell Form with all the navigation and then embeds a UserControl based on there navigation choices. I need to be able to tell if they have made any changes in any of the controls so that I may pop up ...

Most efficient way of loading data into LINQ object for search result type method

I currently have the following: public IEnumerable<News> NewsItems { get { return from s in News.All() where s.Description.Contains(SearchCriteria) || s.Summary.Contains(SearchCriteria) select s; } } The problem is I only need to return the one property that actually has the data as well as the Title proper...

Text Box Databinding in a Winform App, what am I missing

I am trying to implement some very simple Data Binding in my User Control that runs in a WinForm app. The User Control is extended like so --> public partial class ucDiagnosis : XtraUserControl, INotifyPropertyChanged Then on that User Control I have this Property --> private string m_Pets; public string Pets { ...

Custom attribute only on specific classes

Hi, I would like to define a constrait on my custom (PostSharp) attribute. My goal is to get error or warning while compile time, if class X dont implements Y interface but it has my attribute. So this should work: [MyAttributeOnlyForY] public class X : Y { ... } but this should break the compile process: [MyAttributeOnlyForY] publ...

Button not firing onClick below Panel controls in IE

Hi, I have a button which is not working when placed below two panels. If I move it above the panels, it works. It works either way in Firefox. It does not work in IE 8 The button runs this code protected void Button2_Click(object sender, EventArgs e) { panelForm.Enabled = true; //input panel panelOutput.Visib...

Directory.Delete(path, true) always gives error - ASP.NET 3.5 MVC

Hi, I'm using MVC ASP.NET 3.5 and I'm trying to delete a folder with all files within using standard .NET method that I've always used in .NET 2.0. I found this but the first answer doesn't seem to work. I've tried this one try { Directory.Delete(path, true); } catch (IOException) { Thread.Sleep(0); Directory.Delete(path, t...

Convert DataTable to Linq

I'm trying to convert DataTable to Linq using DIm result = From r in dt.AsEnumerable() Select new ( col1 = r.Field<integer>("id"), col2 = r.Field<string>("desc")) But i get error near 'new (' saying type expected. What is wrong with this query? ...

Web Service hosted by SAP and consumed by a .NET Application

I'm trying to setup an SAP Web Service that would be consumed by a .NET application. Thinking it was simple, I had set the Service up in SAP to use HTTP. I right-click on the "Service References" in the .NET Project Tree, and choose "Add Service Reference...", Enter the WSDL URL locally hosted on our servers, and press Go, then select ...

WPF ObservableCollection CollectionView.CurrentChanged not firing.

Hi folks, I have a problem with one of my ICollectionViews. The ICollectionView's CurrentChanged event i not firing. Please see my code below. XAML: <!-- Publication --> <TextBlock Name="tbkPublication" Text="{x:Static abConst:Print.tbkPublicationText}" Grid.Row="0" Grid.Column="0" Margin="3" ></TextBlock> ...

Making an HTTPWebRequest and Events (Erorr: The underlying connection was closed: An unexpected error occurred on a receive)?

I have a page that makes an HTTPWebRequest to an external system. The external page processes the request and fires some events on its side. I get the "The underlying connection was closed: An unexpected error occurred on a receive." error when the events are fired. If I remove the events from the page, everything works fine. I am thinki...

How to inherit base Textbox to provide colored borders

I have a winform app that we use in house. It has many individual controls on each of it's 25 "pages"(usercontrols). Our user base prefers very technicolor apps...they want a TextBox to be outlined Blue if it is a required field (color should go away if data entered). They want a TextBox to change to outlined Green if data has been ch...

Strings in Embedded resource - Failed to access

Hi, I am using Visual Studion 2008, Framework 3.5 SP1. I have an assembly in which I have Strings.resx file. This file contains serveral strings. All over this assembly, I just get my strings back using "Strings.MyString" as it generates a CLR class. It compiles fine and no issues. But when I try to use this assembly in other solution, ...