.net

DataGridView does not show all rows at first (.NET 3.5/VB 2008)

I fill the DGV by looping through a dataset and adding a DGV row for each datarow. After this the DGV.RowCount = DataSet.Rows.Count. Funny thing is that the DGV shows only a part of it (19 of 2448 in my example). After some testing I figured out that the rows show up if I change the Window size a bit. So now I use a work-around by inclu...

Is it possible to tell if an object is running in a different AppDomain?

I want to know if I can tell what appdomain a object was created in. This is for a unit test but also useful general knowledge. I have the following pieces of code (this is example code for illustration). public Foo Create() { AppDomainSetup appDomainSetup = new AppDomainSet { ApplicationBase = @"z:\SomePath" } AppDoma...

Logging InnerException using Log4Net

How do I log inner exception with Log4NET? This is my current conversion pattern: <conversionPattern value="%date [%appdomain] %-5level %logger [%property{NDC}] - %message%newline" /> ...

How do I convert a binary file to a byte array?

Given the path of a file (e.g. "C:\MyPicture.jpg"), how do I convert a binary file into a byte array? I know I have a lot of .NET objects at my disposal, such as BinaryReader, FileStream, StreamReader, and others, but I'm not sure of the best method to take a binary file and convert it into byte[]. How might this be accomplished? ...

Can an ICommand's CanExecute method be redefined dynamically?

I've been unable to find any info on this, which seems like it could be the only way to solve a past unanswered question of mine on SO. However, I think this should really be a separate question now. I am wondering if there is a way to dynamically redefine an ICommand-derived class's CanExecute method. I'm still new to .NET and perhap...

How to see JIT-Compilated code in .NET VM (CLR)

Hi, How can I have a trace of native code generated by the JIT-Compiler ? Thanks ...

AppDomain and MarshalByRefObject life time : how to avoid RemotingException ?

Hi, When a MarshalByRef object is passed from an AppDomain (1) to another (2), if you wait 6 mins before calling a method on it in the second AppDomain (2) you will get a RemotingException : System.Runtime.Remoting.RemotingException: Object [...] has been disconnected or does not exist at the server. Some documentation about t...

Filter and Find from in-memory data sets

I have several medium-sized data sets in-memory that I need to be able to filter and find information from quickly. The data sets are small enough that I don't want to take the performance hit of going to a database every time I need an entry but large enough that I really need to index the data somehow. Currently, I'm using POCO object...

Can you change the ConnectionString configuration value at runtime?

Is it possible to change the ConnectionString value in a app.config at runtime? According to the MSDN documentation it should be possible as the ConnectionString property "Gets or sets the connection string." My code looks like this: ConnectionStringSettings mainConnection = ConfigurationManager.ConnectionStrings["mainConnection"]; mai...

c#: Generate a new single image that repeats another image for x times horizontally

I'm looking for sample .NET code (System.Drawing.Image) that does the following: Load a given image file. Generate a new single image that repeats the orginal image for x times horizontally. ...

Network Authentication when running exe from WMI

Hi, I have a C# exe that needs to be run using WMI and access a network share. However, when I access the share I get an UnauthorizedAccessException. If I run the exe directly the share is accessible. I am using the same user account in both cases. There are two parts to my application, a GUI client that runs on a local PC and a backen...

IronRuby and XAML Databinding

Does anyone know if Microsoft plans on implementing XAML (declarative) databinding of IronRuby objects for Silverlight and WPF? Without it, using IronRuby for Silverlight/WPF development really isn't all that compelling (IMO). ...

Windows Form and Html Link

Is possilbe to open up a link from a windows form app like so: System.Diagnostics.Process.Start('http://www.Stackoverflow.com'); But have the link open in the current ie7 or ie8 that is already open? Currently we have an that loads a page when the user loads some info. We need it to load the same tab. ...

stringtemplate .net dynamic object

Hi I am using string template to render some content, but the content may be variable so not sure how to pass it in (using .net / c#) Basic idea is I have a List> which need to end up as parameters, e.g. List<KeyValuePair<string, object>> ret = new List<KeyValuePair<string, object>>(); ret.Add(new KeyValuePair<string, object>("elem1",...

Reading Java UUID (from DB) in C#

I'm trying to map a table, where one of the column is a binary array (which is a Java UUID), to a C# class. I would like to read the byte array and return a string representation of the UUID. Just wondering what's a good place to start. ...

When using .Net Interop (generated with TlbImp) my COM object refuses to execute in surrogate (dllhost)

This is very odd. We have some managed C++ (an assembly) which uses a .NET COM interop dll generated by TlbImp to make calls into a COM object. When we register the COM DLL we specify that we want it to execute within a surrogate (the "DLLSurrogate" registry entry). Our COM DLL is 64-bit and is executing on a 64-bit platform. When we ...

Distributing VB.NET App...What is causing System.DllNotFoundException

I've successfully built and tested a vb.net app in VS 2008 that uses a dll (abcTest.dll) built by another developer. However, when I deploy the application to another machine (Release directory contents), I get "System.DllNotFoundException" when I run the executable. The dll is in the same directory as the executable, etc. The solutio...

Prerequisites to run Web Deployment projects

Hi, I'm installing a product developped in ASP .NET 3.5 SP1 I made a setup using ASP .NET Web Deployment Project. The Setup runs without any problems on one server, and fails on a freshly installed one. The .NET 3.5 SP1 framework is installed on a fresh W2k8 Server. Anyone knows what I should install to get the Setup running? ...

VBCodeProvider Error - error BC2006: option 'r' requires':<file_list>'

I am trying to use the VBCodeProvider to dynamically compile an assembly. The problem I'm running in to is that I need to give the CompilerParameters class a list of referenced assemblies. The code being used is this: CompilerParameters parameters = new CompilerParameters(); parameters.ReferencedAssemblies.AddRange(AppDomain.CurrentDom...

do postback programatically from iframe to parent page

I have a aspx page, in that page i have an Iframe. In the Iframe i do some stuff in code behind and when it is done I would like to do a postback from the aspx. In other words, Is it possible to do a postback programatically from the code behind of the iframe to the parent page? I think a postback can be done using "ClientScript.GetPo...