Questions tagged [vb.net]

Visual Basic .NET (VB.NET) is an object-oriented computer programming language that can be viewed as an evolution of Microsoft's Visual Basic 6 (VB6) but implemented on the Microsoft .NET Framework.

Filter by
Sorted by
Tagged with
20
votes
2answers
3k views

Search a big (13 GB) Outlook PST file

I have an Outlook PST file of a pretty big size (13 GB). For some indexing purpose I needed to scan through the full PST file to get all the PR_SEARCH_KEY and then ...
13
votes
3answers
473 views

Optimize a Date and Timespan function

I have a working function that may be optimizable. Currently processing 4 objects gives me 0.0459822 for the elapsed time in seconds - used for testing purposes. ...
13
votes
1answer
472 views

.NET 4.5 licensing subsystem using RSA-4096 strong name key, SHA256 signed XML, and assembly signature enforcing

Abstract For the past week I have been looking at taking advantage of the .NET 4.5 improvements to code signing and XML signing to produce a licensing subsystem I can use to license my own products. ...
12
votes
3answers
1k views

Security issues in a SQL query and possible function?

By adding more and more features to my websites, I am now up to 7 different hard coded queries. I have read a lot about SQL injections and possible flaws and security issues, and wanted to make sure ...
12
votes
1answer
594 views

Utility functions for supporting memoization for functions

I've got a couple of utility functions to support memoization for functions with anywhere between 0 to 8 arguments: ...
12
votes
1answer
828 views

Remove Empty Argument Lists from Attributes

I converted a C# analyzer for removing empty argument lists from attributes to be a C# and VB.NET analyzer: ...
11
votes
3answers
291 views

Proper way to validate from sub to sub

I am using a public validating sub to help validate the other subs. Is this the most efficient way to do this? ...
11
votes
3answers
829 views

Give me thy name, I'll invoke thee

This generic function invokes a property of a given object by name: ...
11
votes
2answers
307 views

VBuzz all fizzed up

I don't normally write vb.net code, and I would rather maintain a monstruous vb6 project than a simple vb.net one. There's something about fizzbuzz going on this weekend, that pushed me to write this:...
11
votes
1answer
2k views

Another way to implement weak event handlers in vb.net

Summary: Please let me know, what weaknesses do you see in the described workaround for event handlers preventing garbage collection of registered listener objects... I'm in the development of and ...
10
votes
3answers
2k views

Data Access Layer code for MSSQL Databases

We use this class quite a bit for boilerplate / glue that allows web services and applications to call databases. This code is very important, and I'd like to ensure I'm getting the best performance ...
10
votes
5answers
1k views

Using TryXXX pattern to avoid exceptions

I have been using the TryXXX and GetXXX pattern lately to give clients a choice whether to trap an exception or to read a boolean. An example of this concept would be ...
10
votes
4answers
5k views

Find if value exists using SQL True/False Return

Aim: To Assess if one, or more, examples of a value exists in a Database in the quickest time as I only needs a True/False result. The variable is Alphanumeric. Question: Is this the quickest and ...
10
votes
4answers
877 views

Splitting company name into 3 strings

I wrote an algorithm which should cut a companies name into 3 strings. Input: 1 String Output: 3 String. Conditions: String 1 2 and 3 shall not be longer then 35 signs. If the Input ...
10
votes
3answers
7k views

VB.NET code to AES encrypt and decrypt

I wrote this for use internally at work and have never worked with encrypted data before, so can you please critique? It's written in VB.NET which I have decent experience in, just not the encryption ...
10
votes
2answers
1k views

Number to Words

I have to convert positive numbers, that are less than 1000, to words. A quick search didn't find anything that looked good to my eye, so I came up with the following. While I was at it I expanded ...
10
votes
1answer
1k views

Rendering an HTML form based on a specification in a string

Here's a brief explanation of my method: Provide a string and parse it to HTML code respecting a specific format. The accepted format is: For dropdown menu : Test DropDown~Select:Options1; ...
10
votes
1answer
75 views

Autocompleting locations

Can this function be cleaner? It looks to me that I have too much nesting (Using + If + While...
9
votes
3answers
244 views

Automatic variable generation from data table

I am adjusting Fast Report to create some reports, and I have created a loop that runs through query results stored inside a datatable and assigns each TenantName ...
8
votes
3answers
1k views

Calculate a payment due after X age

I have inherited a function which calculates a first payment due after a certain age. Using the function I typically pass in database values to custom calculate certain dates: ...
8
votes
3answers
164 views

Collect and calculate average times from log, then display top 10 longest durations

Here's a novel-length summary of the issue: I'm trying to write a VB.net program to help me collect remote site statistics from system-generated logs, but I'm a little like a carpenter who only knows ...
8
votes
2answers
1k views

ROT13 encoder/decoder

This is a simple utility, intended to sit on the desktop for when needed, that does the simple ROT13 encoding and decoding. I am used to coding in VBA, and I am interested in more .Net idiomatic ...
8
votes
2answers
143 views

Searching string for character not in array

I have a string which I want to check for characters other than those in this list {"1", "2", "3", "4", "5", "6", "7", "8", "9", "0", ".", "i"} however this check gets run several thousand times a ...
8
votes
1answer
173 views

Barcode (Code 128)

I wrote the code below to generate Code 128 barcodes, based on the specs. ...
8
votes
1answer
367 views

Using Delegates and BeginInvoke with .NET 2.0 WebServices

I'm attempting to implement a simple long-polling/comet/reverse AJAX solution, and came across the concept of delegates, specifically with the BeginInvoke and ...
8
votes
1answer
620 views

Function that recursively downloads entire directory is slow

I created this function to recursively copy an entire directory from an FTP server. It works just fine except that it is about 4 times slower than using FileZilla to do the same operation. It takes ...
7
votes
2answers
11k views

Database access class using VB.NET

I've recently been asked to make some emergency changes to a legacy application written in VB.NET. I come from a C# background so am not overly familiar with this language, though there are enough ...
7
votes
3answers
443 views

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

I've got a database table in my application called "periods". The structure of the table is: Year (Number) Month (Number) Period (Text) The Year column stores years (Say, 2016), Month stores months (...
7
votes
3answers
207 views

Convert integer to full text string duration

I have a function I have written in VB for use in SSRS 2012. It takes an integer and converts it to full text duration - for example 900 becomes "15 minutes", 9000 becomes "2 hours 30 minutes", and ...
7
votes
3answers
740 views

Data Access Layer

This code review request is regarding data access layer coding. I have used the method I am about to describe in a few smaller applications, but I am noticing limitations that I would like to avoid in ...
7
votes
2answers
2k views

Checking and updating lines in a file

I am trying to check a bunch of files that should have a leading | delimiter but sometimes don't. If the first line doesn't have the ...
7
votes
1answer
703 views

Removing XML Doc Comment Nodes

I recently wrote a code fix to handle many of the C# and VB.NET compiler diagnostics that was merged into Roslyn. Because it handles both, I implemented it as an abstract class with only the sections ...
7
votes
5answers
171 views

Recursive filename search

I have created a little program to search a set of folders holding documents scanned. The folder structure is as follows: c:\images\year\month\date\documenttype\firstpartofdocumentNo.\ the ...
7
votes
1answer
2k views

Traffic light implementation

Can someone review this code for me? I'm not completely sure I did this correctly. I also would like help creating the code for the "walk" "don't walk" lights. I needed to create a traffic ...
7
votes
1answer
257 views

Updating every field of every page in a form

I have some VB code that connects to a MySQL database to update every control on every page of a form in our database. I am told this is taking longer than it should to run. The 'Setup MySql ...
7
votes
1answer
172 views

Customized Template Login

While the MVC4 template provided by Microsoft is useful, I feel there are a few scenarios that should be covered to help out users trying to log in. Allow the user to log in with their email address ...
7
votes
2answers
381 views

Optimizing this Excel automation

The createReport method takes around 30 seconds to execute and I was wondering how I could optimize it. I'm using the ...
6
votes
4answers
273 views

Fizzbuzz of course

My second attempt with vb.net - I tried taking the advice from yesterday's question into consideration, but I did not try using LINQ. You know the drill: A programming challenge that prints the ...
6
votes
2answers
1k views

Making error messages more efficient

I am using a way of making error messages, and it works fine. It is just starting to get a little annoying as my project gets larger. I was wondering if there was a way to do with with out having to ...
6
votes
3answers
676 views

Shutdown Delay Program

I wrote this program a while back that would allow me to set a delay, say 3 hours, and when the delay had expired, my PC would turn off. The purpose of it was so I didn't have to leave my PC on all ...
6
votes
2answers
2k views

Positive integer to Roman Numeral conversion function

For the past two hours I was searching for a built-in function for converting an integer to an equivalent Roman numeral, but it failed to achieve the target. Hence I wrote my own routine for ...
6
votes
3answers
4k views

Cryptographic Random Number Generator function implementation

While surfing and through some experimentation, I have a new method to generate random numbers without using Randomize or Random ...
6
votes
3answers
2k views

Notify user of upcoming expiration of subscription

Here is some VB code that is part of a major system of apps that I have been asked to maintain, one of the more fun things that I get to do is rewrite some code here and there, I have done a little ...
6
votes
3answers
2k views

Creating new string with only distinct letters

Aim: To have only one of each character on the Return string: ...
6
votes
2answers
727 views

Adding to an index of authors

I'm new to SQLite but have programmed in BASIC (and other languages) for pushing 50 years. Given the sample code extract, please offer suggestions for improvement: ...
6
votes
2answers
95 views

Calling functions with different variable types

I need to call the function that will get the value of a datatable cell with the ColIndex, either a text (column name) or an integer (...
6
votes
1answer
290 views

Regular Expression matching customer number strings

Using VB.NET, I have created an AddIn for Autodesk Inventor and the customer has a bunch of drawing number strings which follow this sort of scheme: P01867-13-TP09-001-4950-1775-1175-895-1125-...
6
votes
4answers
6k views

Function to test if the current time is within a time window

I have written the following code that tests if the current time is within a time window. It seems to work ok with my test cases, but I would be interested if anyone can see any possible problems or ...
6
votes
2answers
455 views

Get list from database in 3 layer model

I'm working on some testing project. For some reason I think I'm doing something wrong with the architecture. I have a simple example to show what I mean. Database class ...
6
votes
2answers
217 views

Inversion of an array that contains indices

I have an array of length n that contains numbers from 0 to n-1 in random order. I now want to "inverse" this array to one that where index i corresponds to the location of i in the source array. ...