vb.net

Reliable Timer in a Console Application

I am aware in dot net there are three timer types (see http://msdn.microsoft.com/en-us/magazine/cc164015.aspx). I have chosen a the threaded timer as the other types can drift if the main thread is busy and I need this to be reliable. The way this timer works in the control of the timer is put on another thread so it can always tick alo...

Decoding T-SQL CAST in C#/VB.net

Recently our site has been deluged with the resurgence of the ASPRox bot SQL Injection attack. Without going into details, the attack attempts to execute SQL code by encoding the T-SQL commands in an ASCII encoded BINARY string. It looks something like this: DECLARE%20@S%20NVARCHAR(4000);SET%20@S=CAST(0x44004500...06F007200%20AS%20NVARC...

Floating Point Number parsing: Is there a Catch All algorithm?

One of the fun parts of multi-cultural programming are numbers formats. Americans use 10,000.50, Germans use 10.000,50, French use 10 000,50 etc. My first approach would be: Take the string, parse it backwards, until I encounter a separator and use this as my decimal separator. The obvious flaw with that: 10.000 would be interpreted as ...

How do you migrate a large app from VB6 to VB .net ?

My company makes a monolithic piece of software that our customers use to run their car dealerships. The original app was written in VB6, and it has grown substantially over the last few years. Until now, there hasn't really been a business case for switching to the .net framework. Sure, it's newer, considerably better at certain things,...

CSV File Imports in .Net

I realize this is a newbie question, but I'm looking for a simple solution - it seems like there should be one. What's the best way to import a CSV file into a strongly-typed data structure? Again simple = better. Thanks....

Setting Objects to Null/Nothing after use in .NET

Should you set all the objects to null (Nothing in VB.NET) once you have finished with them? I understand that in .NET it is essential to dispose of any instances of objects that implement the Idisposable interface to release some resources. Although the object can still be something after it is disposed (hence the isDisposed property ...

'Best' Diff Algorithm

Hi, I need to implement a Diff algorithm in VB.NET to find the changes between two different versions of a piece of text. I've had a scout around the web and have found a couple of different algorithms. Does anybody here know of a 'best' algorithm that I could implement? Thanks, - Chris...

What is the best way to deploy a VB.NET application?

Generally when I use ClickOnce when I build a VB.NET program but it has a few downsides. I've never really used anything else, so I'm not sure what my options are. Downsides to ClickOnce: Consists of multiple files - Seems easier to distribute one file than manageing a bunch of file and the downloader to download those files. You have...

What's the best way to find long-running code in a Windows Forms Application

I inherited a Windows Forms app written in VB.Net. Certain parts of the app run dreadfully slow. What's the easiest way to find which parts of the code are holding things up? I'm looking for a way to quickly find the slowest subroutines and tackle them first in an attempt to speed up the app. I know that there are several code profil...

Long-time LAMP Developer moving to VB.NET

I've been developing with PHP5/MySQL for years, but recent circumstances have pushed me to move towards the .NET platform. I'd be interested to hear any advise from someone who has gone through this transition... What are some things you wish you knew when you started? I also have a Java background so I'm not scared of the OO aspect ...

Best SVN Client Ignore Pattern for VB.NET Solutions?

What SVN Ignore Pattern should TortoiseSVN have for a VB.NET solution?...

What is the best way to wrap time around the work day?

I have a situation where I want to add hours to a date and have the new date wrap around the work-day. I cobbled up a function to determine this new date, but want to make sure that I'm not forgetting anything. The hours to be added is called "delay". It could easily be a parameter to the function instead. Please post any suggestions. ...

'Break' equivalent keyword for VB

Just moved over to the VB team here at work. Quick easy one for my 1st question. What is the equivalent keyword to break in VB, i.e., to exit a loop early but not the method? Cheers! ...

VB.NET - IsNothing versus Is Nothing

Does anyone here use VB.NET and have a strong preference for or against using 'IsNothing' as opposed to 'Is Nothing' (for example, 'If IsNothing(anObject)' or If anObject Is Nothing...')? If so, why? EDIT: If you think they're both equally acceptable, do you think it's best to pick one and stick with it, or is it OK to mix them?...

Default Form Button in FireFox

I am building a server control that will search our db and return results. The server control is contains an ASP:Panel. I have set the default button on the panel equal to my button id and have set the form default button equal to my button id. On the Panel: MyPanel.DefaultButton = SearchButton.ID On the Control: Me.Page.Form.De...

Is String.Format as efficient as StringBuilder

Suppose I have a stringbuilder in C# that does this: StringBuilder sb = new StringBuilder(); string cat = "cat"; sb.Append("the ").Append(cat).(" in the hat"); string s = sb.ToString(); would that be as efficient or any more efficient as having: string cat = "cat"; string s = String.Format("The {0} in the hat", cat); If so, why? E...

Change the width of a scrollbar

Is it possible to change the width of a scroll bar on a form. This app is for a touch screen and it is a bit too narrow. ...

Visual Studio - new "default" property values for inherited controls

I'm looking for help setting a new default property value for an inherited control in Visual Studio: class NewCombo : System.Windows.Forms.ComboBox { public NewCombo() { DropDownItems = 50; } } The problem is that the base class property "DropDownItems" has a 'default' attribute set on it that is a different value (not 50). As a re...

Naming convention for VB.NET private fields

Is there an official convention for naming private fields in VB.NET? For example, if I have a property called 'Foo', I normally call the private field '_Foo'. This seems to be frowned upon in the Offical Guidelines: "Do not use a prefix for field names. For example, do not use g_ or s_ to distinguish static versus non-static fields." ...

Datatables, Dataviews and distincts! (ASP.Net/VB)

Has anyone got anything better than creating a copy of the original datatable and then looping through it to create a distinct view ? From what I've read and attempted, the dataview doesn't support distinct (currently system is in Studio.NET 2003 - looking to move to 2005 shortly but 2008 isn't on the radar - so if newer versions do, pl...