.net

How to refresh datagridview when closing child form?

I've a dgv on my main form, there is a button that opens up another form to insert some data into the datasource bounded to the dgv. I want when child form closes the dgv auto refresh. I tried to add this in child form closing event, but it doesn't refresh: private void frmNew_FormClosing(object sender, FormClosingEventArgs e) {...

How do I know if the profile for the user executing an application is a temporary profile?

In a C# application, I'm creating a signature using DSACryptoServiceProvider. If the user executing the apllication has a temporary profile, I get an exception: CryptographicException: "The profile for the user is a temporary profile." The failure can be solved if I set DSACryptoServiceProvider.UseMachineKeyStore = true; But I first wan...

VB Byval I don't need it.

I don't need this declaration because it only makes my code big and unreadable. Is there a way to make Visual Studio (VS) not add it automatically. Every time I remove it, it is added back by VS. Function DoStuff(Tom As String) NOT Function DoStuff(ByVal Tom As String) ...

Programmatic Control of Firefox

Is there a .NET-accessible (i.e. .NET or COM) library that I can use to programmatically control Firefox? I'm looking for something that is a bit like ShDocVw.dll for IE. Doesn't have to do all that much, basically all I want to be able to do is programmatically add a bookmark. ...

Is there a better way to handle validation in LINQ to SQL?

Are there any ways, besides throwing exceptions, that one can go about using the partial validation methods in LINQ to SQL to cancel the insert of a record? ...

XLS parsing and marged cells

I am writing my school schedule 'parser' to get it from xls to relational database (SQL Server) trough my website. I know how to get data from uploaded xls file but the problem is that some classes cells are merged for couple of groups in a row. Problem is xls saves info about merged cell in document styles. example : Is there a way ...

VB.NET dynamic use of form controls

I have 10 labels named lbl1, lbl2, ... lbl10 I'd like to change their propriety (using a cicle) with the cicle index for i as integer=1 to 10 step 1 lbl (i) = PROPRETY 'I know this is wrong but it's what I would do... end for I'm using a workaround, but I'm looking for a better way.. Dim exm(10) As Label exm(1)=lbl1 ...

What's the equivalence of vb6.0 frame control in .Net? panel or groupbox?

What's the equivalence of vb6.0 frame control in .Net? panel or groupbox? I recall that using frame in vb6.0 and disable it (frame1.Enabled = False) did not change its fore color of controls within it . ...

Collection that removes items automatically to avoid overflowing.

What I need is a collection where i can specify the max number of elements. If i try to insert an element and the collection is full. The first element in the collection is removed, so that it does not overflow. Is there such an object in .net or do i have to make it myself? ...

Replace multiple lines with .net Regex

Hi guys, I am new to stackoverflow (my first post) and regex. Currently i am working on a simple dirty app to replace baseclass properties with ctor injected fields. (cos i need to edit about 400 files) It should find this: ClassName(WiredObjectRegistry registry) : base(registry) { and replace with: ClassName(IDependency paramName,...

Get the Count of Elements where candidate has won

LINQ2Xml: I would like to get the count of elements where candidate has won in every province. I need some help. <Pronvice_Data> <Pronvice>PronviceA</Pronvice> <Registered_Voters>115852</Registered_Voters> <Sam_Kea>100</Sam_Kea> <Jeje>500</Jeje> <John_Doe>400</John_Doe> </Pronvice_Data> <Pronvice_Data> <Pronvice...

added 3 tree views in my master page,but they r not visible

I added 3 tree views in my master page, i want them to show them based on different conditions, but they are not visible on other pages. Code: Dim TreeView1 As System.Web.UI.WebControls.TreeView = New TreeView Dim TreeView2 As System.Web.UI.WebControls.TreeView = New TreeView Dim TreeView3 As System.Web.UI.WebControls.TreeV...

.Net using Chr() to parse text

I'm building a simple client-server chat system. The clients send data to the server and the server resends the data to all the other clients. I'm using the TcpListener and Network stream classes to send the data between the client and the server. The fields I need to send are, for example: name, text, timestamp, etc. I separate them u...

How to find the dates of a calendar week?

How to get the date of a specific week in a specific year? For example: I have the data week 30, year 2009 - how I can get the date of the week? Language is C# ...

how to use ConversionRate() function in CurrencyConvertion webservice?

I have included following webservice in my project http://www.webservicex.net/CurrencyConvertor.asmx There i got a function as ConversionRate() which takes parameters as follws double Rate; CurrencyConvertor ccs = new CurrencyConvertor(); Rate= ccs.ConversionRate(Currency.USD, Currency.INR); lblResult.text=Rate.toString(); It works...

List assignment from child to parent

I am trying to do this: List<Parent> test = new List<Child>(); The complete code of my class is this: class Program { public static void Main(string[] args) { List<Parent> test = new List<Child>(); test.Add(new Child()); test.Add(new AnotherChild()); } } class Parent { } class Child : Parent { ...

Storing and loading program data, C# WPF

I'm writing a utility program with C# in WPF that allows users to create role-playing scenarios, including monsters, items, characters, etc. The user will create or import the elements (monsters, etc) and then use the imported elements to create scenarios. Everything used by the program is created within the program, so I don't have an...

Custom URI kinda flexible file descriptor

Good afternoon, I am currently starting to think & prototype about a (.net based) new project which will use MEF extensively and one part will be to plug in new 'storage' types besides a normal file/directory storage (e.g. using scms (clearcase, perforce etc), SAP EDM for long term archiving, OpenText LiveLink etc). Now all of them have...

What happened to the .NET version definition with v4.0?

I'm building a C# class library, and using the beta 2 of Visual Web Developer/Visual C# 2010. I'm trying to save information about what version of .NET the library was built under. In the past, I was able to use this: // What version of .net was it built under? #if NET_1_0 public const string NETFrameworkVersion = ".NET 1.0"; ...

Why can't I declare new variables in the immediate window?

This could save me so much time. Sometimes I find myself writing things like this in the watch or immediate window: MyObject.Function1.Fuction2.Fuction3.Fuction2 Instead I could just declare several new variables and do this in a more structured way. However doing this is not allowed. Is there some way that i can do this? Is there...