.net

What FontFamily Fonts can I use in a ListBox?

I'm trying to change the FontFamily of a ListBox to a fixed-width font, but I don't know what's available. Here's what I have: <ListBox Margin="12,55,12,12" Name="listBox1" FontFamily="Arial" /> When I try something like FontFamily="Courier", it won't show up as Courier, which leads me to believe that font may not be available. I've...

How can I stub the Properties.Settings object when the unit test is in a different assembly?

I have an object the references a bunch of Properties.Settings.Default... values and I need to stub these in the unit test for this object. Unfortunately the type for the settings object is declared as internal and so I can't access it from the unit test project. How can I stub up the return values for these properties? I'm using Rhino...

Problem with Anchor property of controls inside UserControl

Hi everyone, I've got this problem when creating a new custom UserControl. In details, I create a derived UserControl with a DataGridView that has Anchor property set to [Left, Top, Right, Bottom] so that the DataGridView can resize whenever the UserControl container's sizes change. But when the application runs, the result is not exac...

Linking 32-bit libraries to a 64-bit .NET application and memory consumption

I was compiling a .NET application targeting x86-64; however, the application references a 32-bit dll. The executable compiles fine, but Visual Studio throws a warning: Referenced assemply 'path/to/dll' targets a different processor than the application. Now, my understanding has been that you can't simply link a 64-bit executable...

c# application: how to view the loaded assemblies

The depends.exe tool can walk thru all the dll's that the executable depends to, but if the DLL is loaded by the Assembly class dynamically at runtime, how can I see the already loaded DLLs(assemblies)? ...

How does Copy Paste of formatted text work?

I'm confused about what implements the functionality of copy and paste. This is exactly what I'm confused with: When I copy formatted text from MS Word (which uses a different markup language than HTML) and paste into an RTF editor in a web browser like gmail or http://www.freerichtexteditor.com/index.php?inc=demo/index the formatting i...

How to change connection string automatically on build with Nant

Hi, is it possible to change the connection string in my web.config automatically when build type is release using Nant? if so, how? thanks ...

Windows 7 for .NET development

Are there any special features or advantages that make it worthwhile switching from Windows XP to Windows 7 for .NET Web/Windows/Office development? I'm currently using Visual Studio 2008 on XP box. Should I upgrade to Windows 7? ...

When to throw exceptions and when to log them ?

I have a three layer structure 1. Presentation layer 2. Business layer 3. Data Layer The Presentation layer interacts with the business layer via a service facade . Now I am confused on where should I throw my exceptions , where should I log them and where should I catch and swallow them . Currently I am swallowing my exception in ...

checked list box Data Source Does

hi i have bounded a checked list box To a Data Source Which has been declared in class scope , but when i update data source in some method , checked list box does not change , but when i recall following codes again it changes : private void UpdateDataSource(string textToSearch ) { dsContacts = dbSms.fillDataSet("Selec...

Close Popup when focus lost

Hi all, I have a popup containing a ListView. The ListView contains customer names. The popup is openen when a search bar is clicked. The user can enter text in the search bar (TextBox) and the Listview is filterd based on the input. I want to close the popup whenever it loses focus. However, the default "auto close" behaviour StaysOp...

select statement for session

Hi,I am new to .net, i write the select statement for session as like Session["RoleId"] = "select roleid from AdminLogin where username='" + txtUserName.Text + "'"; but i m getting error what is problem with this. Thanks in advance... ...

How to check query statement in Linq to NHibernate?

I'd like to see sql query once linq to nhibernate query is executed to log or check sql query. How can I do? ...

HttpResponse.End vs HttpResponse.Close vs HttpResponse.SuppressContent

Within an ASPX page, I want to end the response at specific points (not due to an error condition), depending on code path, so that nothing else is sent back down the stream. So naturally used: Response.End(); This results in a ThreadAbortException, which is by design. The following seems to work but does not look like the correct ap...

Utilize Paypal IPN with VB.Net

I'm really frustrated trying to use a PayPal IPN and receiving variables back to use in my VB.NET application. It looks like my transactions are going through when I test it, but I can't get the variable values. My rm parameter is the default ("0") and I have Paypal set to auto return because that is the behavior I want. I'm using the...

Is it possible to restate these generic constraints in a cleaner way?

Assume following: public class MyFunkyTable : DbObject { // this class will be generated } public class MyFunkyDomainObject : DomainObject { // this class will be custom-made } public class MyFunkyMapper : Mapper<MyFunkyTable, MyFunkyDomainObject> { // this will be custom mapping code due to wired abstraction and ... "supe...

enter key should save and close and escape key should close without save

In vb dot net, Windows form details should save if I press enter key should save and close and escape key should close without save Currently it happens on onclick event of a button of Save and Cancel, but I wish the keyboard events also work Any quick code to do that is appreciated ...

Returning a boolean from an XPath expression

We would like to implement existance checks of elements via XPath expression. The XPath expressions are defined externally. We are trying to use the XPathEvaluate extension method from System.Xml.XPath, but it complains when we try to do the following. XDocument d = new XDocument( new XElement("test", ...

XDocument.Validate custom validation messages

I'm validating an XML file against a schema using XDocument.Validate and get validation messages which look something like this: The 'http://www.blablah.co.uk/schemas/cbds%3ADOB' element is invalid - The value '1999-0dsf2-21' is invalid according to its datatype 'http://www.w3.org/2001/XMLSchema%3Adate' - The string '1999...

SqlBulkCopy failing with String conversion issue

I have a view which generates a number of columns which I want to bulk load into another table which has identically named columns. This procedure worked fine when I was looping over the SqlDataReader and doing an insert with SqlParameters using a SqlCommand each time. Obviously for many 100000s of rows, this was too slow. I switched t...