.net

How to allow user to set expressions detrmining property value in PropertyGrid

I noticed that programs like Report Builder allow user to set property value or an expression determining property value. I want to the add same functionality to my application. So is there any simple way to do so or do i have to redefine all type converters so that they allow to set expression in addition to their original functionality...

How to serialize this Xml in .NET (array)

I need Xml that looks like this <foo> <bar ... /> <bar ... /> </foo> And currently have the following class structure : [XmlRoot("foo")] public class Foo { [XmlArrayItem("bar")] public List<Bar> myBars; } But this gives me Xml where bar items are wrapped inside a bars element. How should I define my custom XmlAttributes so ...

What's the simplest way to make a scrollable list of controls with labels?

Using C++/CLI and Windows Forms, I'm trying to make a simple scrollable list of labelled text controls as a way of displaying some data fields. I'm having trouble making a TableLayoutPanel scrollable - every combination of properties I've tried seems to result in some really peculiar side effects. So I have two questions: Is this the ...

How to implemenet Password Resets

Hi, I have an existing application that i want to implement password resets after 30 days. But i dont want the user to use the same password as the last 5 times. How do i go about doing this or is there any links i can follow. Please help Thanks, ...

Converting an IP address to a number:

Question: When I convert the IP address 192.168.115.67 to a number, is it done like this: 192*256^3 + 168*256^2+115*256^1+67*256^0 = 3232265027 or like this: 192*256^0 + 168*256^1+115*256^2+67*256^3 = 1131653312 I find both variants online, and frankly it doesn't matter as long as I do all the internal IP-range comparison using the sam...

File Upload in asp.net

I am using FileUpload control to facilitate Image file upload on my website. I want to restrict a user to upload only Image file. I am using if (fupFirmLogo.PostedFile.ContentType == "image/Jpeg") { } to check if the file is a image or not. I want to allow all image extensions like PNG, GiF, Jpeg, tif , BM...

Is Obsolete attribute only checked at Compile time?

Hi, I wonder that the obsolete attribute is checked at only runtime? Think that you have two assemblies. Assembly A uses a method from Assembly B. After that we mark the method in Assembly B as obsolete which causes a compile time error when compiling assembly A. No problem so far but the question is whether the older assembly A cont...

jQuery Validate Plugin overwrite my select onChange postback

Hi, I'm creating this form (.net) where i have a select with a postback, that will trigger a action depending on which option i select. I'm trying to use the jQuery Validate Plugin (plugin website) to validate my form. My problem is, when i validate the form, and my select is marked as invalid, the validation plugin overwrite it's onCh...

Using #DEBUG macros in spark

I have some scripts which need to be included only in the release version. Stuff like google analytics, quantserve etc. The typical way in asp.net mvc world is to wrap a #if DEBUG #endif How do I do it the sparkish way. Like <script if='x==5' type="text/javascript"> ...

How to call in C# function from Win32 DLL with custom objects

How to use in C# function from Win32 DLL file made in Delphi. When function parameters are custom delphi objects? Function definition in Delphi: function GetAttrbControls( Code : PChar; InputList: TItemList; var Values : TValArray): Boolean; stdcall; export; Types t...

Clear type font usage in C#/VB.net

How to use clear type font in C#/VB.net ? ...

connecting to secure database on private network from website host

Hello all, I've got a requirement to both read and write data via a .net webservice to a sqlserver database that's on a private network. this database is currently accessed via a vpn connection by remote client software (on standard desktop machines) to get latest product prices and to upload product stock sales. I've been tasked with f...

Objective C BitConverter Equivalent

Hi there, I'm wondering if there is an Objective C equivalent to .Net's BitConverter.GetBytes() method. For example, in C#, I can write something like this: byte[] lengthPrefix = BitConverter.GetBytes(message.length); What would the equivalent be in Objective C? Some example code would be greatly appreciated. Thanks in advance. ...

Any good tools or tips for fuzz testing Windows forms applications?

I'm maintaining a ~300K LOC C# legacy thick-client application with a Windows.Forms interface. The app is full of little bugs and quirks. For example, I recently discovered a bug where if a users edits and tabs (not clicks) through cells on a DataViewGrid, and leaves the a certain cell selected, the app gets an "Object reference not se...

how we can save a file as temporary basis

how we can save a file as temporary basis i have a xml file it is in encrypted mode i want to decrypt it .but i want it doesn't save on disk rather it save on flash memory. after decryption i have to read values and then it should destroy(decrypted xml file). ...

Update a field from server without reloading the existing page using simple javascript.

I want to change a value of a field say document.getElementById('reloader').innerHTML = updated value from Server I do not want to use Ajax, PHP, ASP, JSP .. or anything like these. Is it possible by using simple javascript? Server is C# 's application made by using HttpListener. Please question if needed more info. ...

what is the difference between static class and normal class?

when i prefer static or normal class? Or what is the difference between them? using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace staticmethodlar { class Program { static void Main(string[] args) { SinifA.method1(); } } static class SinifA ...

c# marshaling dynamic-length string

i have a struct with dynamic length: [StructLayout(LayoutKind.Sequential, Pack = 1)] struct PktAck { public Int32 code; [MarshalAs(UnmanagedType.LPStr)] public string text; } when i'm converting bytes[] to struct by this code: GCHandle handle = GCHandle.Alloc(bytes_array, GCHandleType.Pinned); result_str...

For loop with a non-integer increment in VB.NET

Can a VB.NET For loop be constructed that mimics this C# code? TimeSpan oneDay = TimeSpan.FromDays(1.0); for (DateTime d = startDate; d < endDate; d += oneDay) { // some code } Obviously you could do it without a For loop (i.e., with a While); I'm just curious if there's a certain syntax to construct a VB.NET For loop with a non-i...

Let a regular expression ignore the order of the search terms

I let my users enter a search term: "foo bar". I would to convert the user query to a string that matches the words, but ignoring the order: bla foo bla bar = match ^^^ ^^^ bla bar bla foo = match (order = reversed) ^^^ ^^^ bla bla bla foo = no match (only one word) ^^^ bar bla bla bla = no match (on...