.net

How to get IE8/9 active tab html source by C#

I am trying to create a program in C# in Visual Studio which would acquire html source of a current opened (or selected, or all) tab(s) in Internet Explorer 8/ (prefered) 9. I am tired of copying by - browser-> View Source, alt+a, alt+c, program -> alt+v Anyone got an idea how to solve it? ...

Cannot update entity in Entity Framework 4 using POCO

I have 2 tables : Item and Location (one - many ). I select one location and I try to update it The entity goes from {Id=2, Name="name1",City="city1",Items=null} to {Id=2, Name="name1", City="city2",Items=null} and i want to save the updates. The update method from the base class is: public virtual void Update(T entity) ...

.NET processing JSON Feed

Hi all, I'm looking for a simple example of calling a feed from a url and then looping through the data pulling the values out in C#. I'm managed to get the feed data into a string variable like this. I've looked at the newtonsoft.Json dll but can't find a simple example of pulling the data out. The data isn't complex and i've added it...

Independent DAL Design - Specific and Generic

Scenario: Creating an app for learning purposes and am trying to make it database independent. I have looked at the beerhouse architecture quite a bit where each database has its own dal an a mixture of SqlCommands and DataReaders etc. I no theres not a definite right or wrong, but generally in terms of maintenance, speed etc baring in ...

Possible to have a web style interface in a .net windows form app?

I'm about to develop a rich client desktop app. The last thing I want is the standard form controls, which are pretty boring, good for business apps, but boring for my target audience. I'm proficient in web dev, so I was wondering if there was a way to use more web style custom controls in a .net app. I don't want to have to host a web...

Better way to write this Properties and Constructor code?

I am using Visual Studio 2008 (C#). Is there any better way to write this code? I am a poor programmer. #region Properties public string ItemCode { get { return _itemCode; } set { _itemCode = value; } } public string ItemName { get { return _itemName; } set { _itemName = value; } } public decimal? StockInHand { get...

Custom DataTypeAttribute not triggering validation correctly

Related to this question I have created my own DateValidationAttibute to make sure a string is in a valid date format (e.g., MM/DD/YYYY) [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)] public class DateValidationAttribute : DataTypeAttribute { public DateValidationAttribute() : base(DataT...

Constructor code: When to leave empty and when to instantiate?

Below is the sample code of one of my class: #region Constructors public ItemMaster() { } public ItemMaster(string argItemName, string argItemCode, decimal? argStockInHand, decimal? argAlertLevelQty, string argUnit, decimal? argDiscount, string argWhetherInPercent, int argCategoryID) { this.ItemName = argItemName; this.ItemCod...

Passing query as parameter.

I know, it is not recommended. The possible risk of SQL Injection. In my present app., I created a class containing reusable functions. One such function is this: public static Int32 InsertNewRecord(string myQuery) { ModCon.OpenConnection(); MySqlCommand cmdInsert = new MySqlCommand(myQuery, ModCon.myCN); try { ...

How to catch all exceptions in a user control

I have an user control, which contains multiple methods and each of these methods has a try-catch block. I catch only one type of exceptions, for example ArgumentException. Update - I don't catch one exception but multiple exceptions which I defined. Each of these methods handles the ArgumentException the same way, so I have redundant c...

What LDAP information could be persisted in my application?

Hello, Consider a classic LDAP usage for authentication and consequent calls to check if the user has rights to access an object accessible to groups "foo", "bar" and "baz". I am wondering if I am allowed to persist exact role names, i.e. "foo", "bar" and "baz" and then make CurrentUser.IsInRole("Foo") || CurrentUser.IsInRole("Bar") ...

Is there a way to invoke a .NET Framework offline installation?

I'm making a test application for learning purposes. It's targetted for the .NET Framework 4 Client Profile. I created a new Windows XP virtual machine that doesn't have a .NET Framework installed. Ideally I'd like to create a setup project for my little application and bundle that with the .NET Framework 4 Client Profile. I do not want...

Farpoint Spread replacement

Since 1996 or so we have been using the OCX versions of Farpoint Spread with VB 5.0 and 6.0. We are currently migrating our applications to VB.NET with both web and desktop components. Is Farpoint Spread the best grid control for .NET? we need a very flexible grid, not the standard databound types. Thanks in advance ...

What's the easiest way to use a connected scanner?

Hi there. I'm making an application that your typical CRUD scenario. I also need to scan a document and save that image to disc. I don't really need complex image manipulation, just a simple "call scanner to scan, catch the scanned image" approach. What's the easiest way to accomplish this on a Windows Form .NET 3.5 c# application? T...

How to see the exception of an application when running on client machine?

I installed my Windows Forms .NET 3.5 application and it installed correctly. When trying to run it the application crashes and the typical Microsoft Windows error dialog shows. You know the one that asks you to send an error report. My question is, how can I see what actually caused the program to fail to launch? The application runs ...

First item in databound ListView occasionally being duplicated?

I have a WPF (.Net 4) ListView used to navigate a local Windows directory. It displays the contents of the current directory, with name and size and all that. However, in some directories, the first element it displays shows up twice. For example, let's say in directory "D1" I have subdirectories "W", "X", "Y", and "Z". The ListView will...

Running different code depending on what Net Framework version is installed

Suppose I have a LINQ method that I wanted to run using normal LINQ if the Net Framework 3.5 is installed, but using PLINQ if 4.0 or higher is installed. Is this possible ? ...

.Net (C#) Enum rewritten to java

I have an Enum in .Net. How can I rewrite this Enum in java? Here is the Enum: public enum AdCategoryType : short { ForSale = 1, ForBuy = 2, ForRent = 8, WantingForRent = 16, WorkIsWanted = 32, WorkIsGiven = 64 } ...

Will a C# program for Windows run in Ubuntu under Mono without modification?

i want to write a tcp server in c# under windows. can i run the same program or use the same code under mono without modification. ...

.net working with outlook

i have such code For Each objItem In StartFolder.Items MessageBox.Show("to " + objItem.To) Next if field to is empty(empty in letter of outlook), there is no exception but the debugger shows objItem.To Run-time exception thrown : System.MissingMemberException - Public member 'To' on type 'ReportItem' not ...