.net

How do you bind SQL Data to a .NET DataGridView?

I am trying to bind a table in an SQL database to a DataGridView Control. I would like to make it so that when the user enters a new line of data in the DataGridView that a record is automatically added to the database. Here is my current attempt... BOMClassesDataContext DB = new BOMClassesDataContext(); Form_Load() { ...

How can I get the group name from an Active Directory group with .NET?

I have code which as been working against an older Active Directory server and now I have pointed it to a new Windows Server 2008 AD system. Now the group names are coming back with SIDs and not names. I do not know enough about the AD side to know if there is a way to make the new AD server work like the older AD server. My code is bas...

The Project Location is Not Trusted error in Visual Studio

Quite a simple error, and the reason is obvious - I mapped a network drive, and I am opening the solution from it. Visual Studio gives me this error. I tried googling, and to my surprise, couldn't find a fix. I am running Visual Studio 2008. The solutions I found on google say I should run Mscorcfg.msc, but unfortunately, I don't seem ...

What are the reasons Process.HasExited can throw InvalidOperationException?

I'm seeing a System.Diagnositics.Process.HasExited method throw an InvalidOperationException but the message text property is not terribly useful as to why it was thrown. Under what conditions does this exception get thrown? ...

Good examples of .NET (C#) open source projects ported to Java? ( C# -> Java )

I notice several well-known projects in java that were ported to C# .NET. Some examples: Hibernate -> NHibernate JUnit --> NUnit Ant --> NAnt Lucene --> Lucene.Net, NLucene iText --> iTextSharp log4j --> log4net Quartz --> Quartz.NET I was curious about the reverse situation: what are the notable .NET projects that have been ported ...

Video tutorials for Windows Identity Foundation

Is there a series of webcasts for Windows Identity Foundation. I don't seem to find any that talks about WIF in depth. ...

using construct with sqlTransaction dependent on number of different action results ...

I'm curious if following code would be considered safe? using (SqlConnection cn = new SqlClient.SqlConnection(connectionString)) { cn.Open(); using (SqlTransaction tr = cn.BeginTransaction()) { try { if (!Data.DoSomething1(tr, p1, p2)) { tr.Rollback(); return false; ...

How do I update a .NET DataSet via XMLDataDocument for application to a DataGrid control?

I have a pretty simple operation but am struggling with how to implement it. I am loading XML from an external data source using a DataSet.ReadXml(), then creating a new XMLDataDocument from that data set, then syncing the Dataset with updated data from the XMLDataDocument like so: doc = new XmlDataDocument(dsDataSet); dsDataSet.Enforc...

Uploading Big Files to database with MTOM

I have looked at http://www.codeproject.com/KB/XML/MTOMWebServices.aspx and it's seems like a great way of transferring files between servers. But what If you wanted to upload the file to database?! Do I still need to call database functions on every chunk? Thanks, ...

Regular Expression Help in .NET

I have a simple pattern I am trying to match, any characters captured between parenthesis at the end of an HTML paragraph. I am running into trouble any time there is additional parentheticals in that paragraph: i.e. If the input string is "..... (321)</p>" i want to get the value (321) However, if the paragraph has this text: "......

Problem with finding the next word in RichTextBox

As I enter a character in my RichTextBox, I want to get the next character from the its TextRange. So here is how I do it: TextPointer ptr1= RichTextBox.CaretPosition; char nextChar = GetNextChar(); //we continue until there is a character while (char.IsWhiteSpace(nextChar)) { ptr1= ptr1.GetNextInsertionPosition(LogicalDirection.Fo...

WCF: Is it safe to override the Client's Dispose method using a partial class?

I'd like to override the Dispose method of generated proxy (ClientBase) because of the fact that disposing of a proxy calls Close and can throw an exception when the channel is faulted. The only way I came up was to create a partial class to my generated proxy, make it inherit from IDisposable: public partial class MyServiceProxy : I...

Hot to find a control in a java runtime?

Hi, I have java chat. I will build a automatic login for this chat, but I have no API, only the UI. I will build the application in DotNet 2.0. How can I access the chat-login controls from dotnet? ...

Getting the location from a WebClient on a HTTP 302 Redirect?

I have a URL that returns a HTTP 302 redirect, and I would like to get the URL it redirects to. The problem is that System.Net.WebClient seems to actually follow it, which is bad. HttpWebRequest seems to do the same. Is there a way to make a simple HTTP Request and get back the target Location without the WebClient following it? I'm t...

Iterate through all the controls of a different application?

I am using .NET 2.0. How can I iterate through all controls of a different / foreign WinForm application? ...

Is there a way to export an XSD schema from a DataContract

I'm using DataContractSerializer to serialize/deserialize my classes to/from XML. Everything works fine, but at some point I'd like to establish a standard schema for the format of these XML files independent of the actual code. That way if something breaks in the serialization process I can always go back and check what the standard sch...

How do I change the WPF Expander Header Text when expanded or collapsed?

Using a WPF expander, I want the Header to change from See More to See Less when the control is expanded, and back to See More when it's collapsed again. I'd prefer a WPF pure solution, rather than a C# or other code behind method. I get the feeling this should be easy, but I'm struggling for the right terms to get a solution via google....

problem with sqldatasource and data binding

I am trying to pull out data from the table I had from the database according to the id which is passed from the URL. However I always get data from id= 1? Why? FYI I took this code directly from the ClubWebsite starter kit and copy and paste it to my project to make several changes, the ClubWebsite one worked fine.. but this one doesn't...

Combining lists but getting unique members

I have a bit of a special requirement when combining lists. I will try to illustrate with an example. Lets say I'm working with 2 lists of GamePlayer objects. GamePlayer has a property called LastGamePlayed. A unique GamePlayer is identified through the GamePlayer.ID property. Now I'd like to combine listA and listB into one list, a...

Byte = 8bits, but why doesn't BitConverter think so

Given the following information Public Enum Request As Byte None = 0 Identity = 1 License = 2 End Enum Protected mType As Communication.Request mType = Communication.Request.Identity Debug.Print (BitConverter.GetBytes(mType).Length.tostring) 2 Why does bitconverter report that mType is a length of 2. I would have thoug...