.net

Issues dynamically arranging controls in vb.net

Hi, I am looking for the best way to dynamically arrange the location of labels (or any control for that matter) during runtime in a Windows Forms application using VB.net or C# in VS2008. I have a control that displays messages created by users. This control has a panel docked at the top which holds the header information for each mess...

Telerik radgrid doesn't remember page number

Hi all, I have a telerik radgrid-control on my page for showing a list of articles. If I click a page, then an article and then back to the list again I am back at the first page instead of the one I was at before. Is there a solution for this? BR Larre ...

Relating multiple tables to each other in SQL

Hi! This is more or less a best-practice question: I'm working on a site that requires me to relate some tables to several different tables. For instance, I have a Comments-table, that I would like to relate in a way such as one might comment on entities in Table A, but also in Table B separately. Similarly, I have a rating-table that...

Use Visual Studio Setup Project to automatically register and GAC a COM Interop DLL

I've created a .NET assembly for COM interop and it is working well on my development machine. I'm currently trying to figure out how to deploy the DLL to a target machine using Visual Studio's "Setup Project." How can I use the VIsual Studio setup project to do the following things: Register the assembly (currently using regasm). T...

Report Viewer Expression

Basically, I want to check if the value of field F1 is not empty. If the row not empty then I want to calculate F2 * F3 The following expression always print #Error =IIf(Fields!f1 ="" ,"" ,Fields!f2.Value* Fields!If3.Value) Please help ...

Problems using DevPartner

I'm using DevPartner to track down memory leaks in a long-running .NET/WPF app. DevPartner tells me what classes are being leaked over time (primarily WeakReference, but also EffectiveValueEntry and WeakDependencySource). What I need to know is what other object(s) still have references to these in order to prevent them from being garb...

How to do Discretionary Access Control List (DACL) for .Net Security?

I am interesting in using a Discretionary Access Control List with Membership provided by .Net Security. Are there any implementations of this that exist in .Net or open source? Is there a way to use .Net security as a DACL? Does a custom solution have to be built? Thanks. ...

How can I determine the file name that is being executed in a mono C# environment when the file was created with mkbundle2?

When running a C# application under mono with the "mono " command, the following works: var fileName = System.Reflection.Assembly.GetExecutingAssembly().Location; But after packaging the assemblies into a single file using mono's mkbundle2, the line above does not return the expected result. ...

How to split a string with multi-character delimiter in vb - asp.net?

Hi, How should I split a string separated by a multi-character delimiter in VB? i.e. If my string is say - Elephant##Monkey, How do I split it with "##" ? Thanks! ...

Easiest way to pass modifyable System.String as modifyable LPTSTR ?

BOOL PathFindOnPath( LPTSTR pszFile, LPCTSTR *ppszOtherDirs ); I am calling this API from managed C++. My pszFile is in a System.String. What is the easiest way to pass this as LPTSTR? (Considering its an inout parameter) I have tried pin_ptr and interior_ptr but neither seems to be accepted by the compiler. ...

Java / .NET spawn browser with cookie set

Hi there. I can spawn a browser from my Java thick client using java.awt.Desktop. Apprarently, I can also spawn a browser from my .NET client using System.Diagnostics.Process.Start My question is, is there a way in both Java / .NET to set a cookie when spawning the browser process? It doesn't look like there is - possibly due to secur...

best practice to create a generic user id

What s the best way to implement a method that creates and assings ID s to user on a asp.net application? I was thinking about using DateTime ticks and thread id I wanna make sure that there is no collision and user ids are unique. ID can be a string or long. should i use MD5 on some information that i collect from user? what would t...

Is it possible to programatically set the "Start Parameters" on a Windows Service at install time?

Is it possible to programatically set the "Start Parameters" on a Windows Service at install time? EDIT This isn't actually possible. However, you can edit the image path as per ho1's instructions. ...

Reflection using path strings in .NET

Is there any way to using reflection in .net to get a property's value using a path like so... type t { id : int name : string } type s { id : int st : t { let a = {id = 1; {id = 2; name = "foo"}} a.getType().getProperty("st.name") Sorry for the F#. This doesn't work obviously but it illustrates what I'm trying to ...

Values of local variables in C# after exception?

RedGate has an error reporting tool that says it can "Get a complete state of your program when it crashed (not just the stack trace), including the values of variables when the crash happened – without having to go back and forth in inefficient email conversations with the end-user." I've built a unhandled exception re...

What is the best-practice way to use Linq-to-SQL in a C# application? [Design-pattern]

OK, I'm always trying to improve the way I code because it's my passion. I have a .dbml file (linq-to-sql) and I use it to access my MS SQL database. Imagine, if you will, that you have a Person table in your database and you want to provide a way to delete,add,modify a Person record. The way I'm handling things currently is creating ...

How can I move an XML element above the previous element using LINQ to XML?

I have the following XML structure: <?xml version="1.0" encoding="utf-8" standalone="yes"?> <Root xmlns:xsi="My Program"> <NotRoot Text="Hello"> <SomeOption Text="Option 1" Centered="False"> <SomeOption Text="Option 1.1" Centered="False"> <SomeOption Text="Option 1.1.1" Centered="false"> ...

What country codes are these?

Hi, i have some existing code, and i wonder what kind of country codes they are? Are the somehow mappable to codes somewhere in the .NET framework? <option value="4">Albania</option> <option value="7">Andorra</option> <option value="21">Anguilla</option> <option value="1">Antigua And Barbuda</option> ...

Joining Xs, Ys into Points with Linq

I seem to be a bit stuck on this, but my experience in Linq is not great. Basically, I have something like this code: public class Point { public int X { get; set; } public int Y { get; set; } } public class B { public List<Point> Points { get; set; } public B(IEnumerable<int> Xs, IEnumerable<int> Ys) { // H...

ArrayOf when using List<T> with a WCF Rest Service

Hello, I am trying to create a REST web service using .NET 4.0 and WCF. My REST service is returning a List which then gets serialized into XML. The problem I am having is that the XML being returned starts with ArrayOf, which I don't like. In other words, right now the XML looks like this: <ArrayOfAchievement> <Achievement> ...