Hot answers tagged

21 votes

Search a big (13 GB) Outlook PST file

I would assume that this ...
  • 50.1k
17 votes

Search a big (13 GB) Outlook PST file

COM interop is in itself a performance hit, but even when accessing it through COM (e.g. in VBA), the Outlook type library / object model is notoriously, painfully slow. If performance is a ...
11 votes
Accepted

Data Access Layer code for MSSQL Databases

This whole function needs a little bit of work: ...
  • 28.6k
11 votes

Making error messages more efficient

There's probably much more to say about this code, but there's one point that deserves immediate and serious attention: You're handling errors the way vba and vb6 did it... but this code can only be ...
10 votes

Data Access Layer code for MSSQL Databases

I will review the tests because they definitely need some work! GetDataTableTest() The Test suffix is redundant, they're all ...
10 votes
Accepted

Regular Expression matching customer number strings

^P\d{5}-13-TP\d{2}-\d{3}(-(L|R|\d{4})(-\d{3,4})*)?$ Your current regex is WAY too forgiving. First of all, every one of your example starts with a P followed by ...
9 votes
Accepted

Automatic variable generation from data table

Use array, this will reduce by a lot your number of variables. Name your variable properly ("ten" should be "tenant") Normaly, variable starts with a lower case in .net Do not concatenate your strings ...
  • 875
9 votes

Download Images as fast as possible

Just a few quick remarks (for now): vbNullString is a remnant of VB6 (which I think would be under the ...
8 votes

Making error messages more efficient

So, you have a couple of issues here. First, your question... What I've done in VB6 (which your question was originally tagged as) is create a module that is responsible for reporting errors and ...
  • 30.8k
8 votes

Rendering an HTML form based on a specification in a string

Before we start, take a look at this comment of yours. It's a prime example of why you shouldn't always trust the comments. ...
8 votes
Accepted

Get list from database in 3 layer model

Well, you were right to think you are wrong. We shouldn't need to instantiate an object with an empty constructor to something like this. This is exactly what the ...
  • 25.2k
8 votes

Give me thy name, I'll invoke thee

LINQ has two syntaxes to offer. You've used the method syntax, which I find very neat and useful, but for simpler queries I find the query syntax looks much less bulky in VB.NET: ...
8 votes
Accepted

ROT13 encoder/decoder

The number one problem here is that you concatenate translated letters on to your string one at a time. Since strings are immutable in .NET (and most right thinking languages), this means for the ...
  • 1,350
7 votes

Data Access Layer code for MSSQL Databases

IDisposable Using dt As New DataSet() ... return dt End Using Using dt As New DataTable() ... return dt End Using ...
  • 2,919
7 votes
Accepted

Calling functions with different variable types

If you use this method quit often by passing an Integer you will get performance problems because of the boxing and unboxing of the struct. My advice would be to ...
  • 50.1k
7 votes
Accepted

Fizzbuzz of course

You said beginner, which is good. I'm going to go into a few basic VB.NET constructs that should help you, and then cover a couple advanced ones in detail so that hopefully it's useful for future ...
6 votes
Accepted

Zero pad function trim extra leading zeros

Naming Based on the naming guidelines parameters should be named using camelCase casing. Select Case If you omitt the ...
  • 50.1k
6 votes

Userform that calculates gas mileage

You have a form -- by definition, a window in which text boxes and such can appear. Why are you using MsgBox and InputBox to ...
  • 3,142
6 votes

Automatic variable generation from data table

Couple of things here. A DataTable also makes use of the IDisposable Interface so you should use a using block with that as well no need to explicitly close your connection because the IDisposable ...
  • 28.6k
6 votes

Data Access Layer

Object Disposal The most glaring thing I notice is that you aren't disposing of everything you need to. There's a Using statement for your reader, but both ...
  • 3,608
6 votes
Accepted

Modified TextBox for forms generating SQL statements

There's not much to review here really. I'd be more interested in reviewing the code that's actually doing the work, but here goes. Lose the Systems Hungarian notation. The IDE/Code tells me what ...
  • 30.8k
6 votes
Accepted

Generating controls based on PropertyInfo

Public Interface IViewModelControlMapping End Interface This is called a marker interface - an interface that does nothing. It's a design smell more often than ...
6 votes

Searching string for character not in array

First we'll clean this up a bit, then we'll look at performance. There is absolutely zero reason to be using an anonymous function. This is useful functionality that you will eventually want to call ...
  • 30.8k
6 votes

VB.NET code to AES encrypt and decrypt

This is draft 2 of my answer, didn't notice the beginner so I'll try to be gentle: Why do you use a Module instead of a Class? ...
6 votes

Fizzbuzz of course

First, I would change the way you styled the if statements. Generally the less nesting you have the better. I would go with the more simple: ...
  • 545
6 votes
Accepted

Update 12 records in a database table in less than 13 queries

...
6 votes
Accepted

Convert integer to full text string duration

You should look into the TimeSpan struct, which provides a nice method TimeSpan.FromSeconds(). Having filled a ...
  • 50.1k
6 votes
Accepted

Parse floats to a custom numeric format string

Welcome to Code Review! Nice first question. Instead of using Instr() to check if stringNum contains a ...
  • 50.1k
5 votes

Populating fields from stored procedure

It might have been an ok-ish way of doing things... 15 years ago. This code is astonishingly similar to what one would be writing in vba - minus the Try..End Try ...

Only top scored, non community-wiki answers of a minimum length are eligible