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
2
votes
4answers
89 views

Generating N Prime Numbers

I'm trying to generate N prime numbers where my N = 200,000. The method that I think I wrote is - Start with first prime of 2 Increment possible prime number by 1 See if possible prime is ...
5
votes
1answer
51 views

Tidying and deduplicating files listed in a DataGridView

I have the following code that searches through folder directories in a DataGridView table, and puts all files of the wanted format into a list, it also gathers a list of their last modified date for ...
6
votes
1answer
3k views

VB.NET class for MySQL CRUD

I wrote this code for a few basic CRUD (Create, Read, Update, Delete) applications, but I think it can be improved and refactored. I have 3 SELECT type functions(return a table, return a value, return ...
3
votes
1answer
68 views

Find matching image and metadata files, pull data and rename both

My Original - Read date from a file and rename two files using the date github if you want to see behind the scenes. I like taking pictures of birds. Lots of pictures of birds. My camera counts ...
0
votes
2answers
457 views

VB.NET - Error Handling in Generic Class for PDF Merge

As a part of a project I'm working on, a new requirement has arisen for me to be able to generate multiple PDF files and then merge them together before they are delivered to our client(s). For this, ...
1
vote
1answer
62 views

Class Property Definition to Prevent Unnecessary Database Calls

The challenge I'm facing is creating a class for a Loan object which contains a number of properties, some of which are classes in and of themselves with similar ...
2
votes
1answer
51 views

Documenting and commenting code using xml tags

I am going to rewrite my AddIn I made for the Autodesk Inventor software. It is supposed to do specific task that are not available by default in the program. I am not a programmer but a draftsman ...
3
votes
1answer
107 views

Unit test for a method that populates a dictionary from an API call

I am building a unit test for a method that populates a dictionary from an API call (responding with JSON): ...
2
votes
1answer
3k views

Function to check empty cells found or not in Datagrid

I want to check if any empty cells found or not in a Datagridview when save data to database, so I've written this function: ...
2
votes
0answers
189 views

Draw a panel control with a sunken look

I am relatively new to visual studio. I am in the process of creating a custom control and the same time learning. I have put together the beginning of this control and will love to get some input. ...
1
vote
3answers
393 views

Deck Shuffling Method

Just wondering if you guys think this is a good way to shuffle a deck or a bad way. Updated to show the GetRandom function as requested. ...
3
votes
1answer
626 views

Service calculator! (Tax and tip)

Here is a simple calculator for calculating the tax and tip of a transaction. I have tried to add input verification. I am wondering if there are more elegant ways of doing some simple tasks that are ...
1
vote
0answers
215 views

Read data from Google Sheets API and populate a class

I have data stored in a Google Sheet. The aim of this program controller is to read this data from an MVC controller, and populate a class (Model) with it. I will skip most of the intermediate ...
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 ...
2
votes
1answer
249 views

ETL project, handling XML, CSV, and text files

I have completed an ETL project to collect, parse and load files. I decided to make it clean OOP way using interfaces and abstract, but have some questions below. ...
2
votes
0answers
282 views

Binary addition in VB.net

It starts by taking two user input from the console and putting them into strings. I then pad them to get them to the same length. I get the length of the num1 and assign it to the integer len. I then ...
0
votes
2answers
765 views

Function to test whether file is in use

I needed a method to test whether a given file is in use. Is the code below up to the task? ...
0
votes
0answers
52 views

Extract value from a database and populate objects

I have a database, with some history data for a lot of tags (ie. measurement points in the plant). Users supply a calculation script, and get the result of the calculation as a result. The main ...
2
votes
1answer
225 views

Building a very basic calculator

I have been a VB developer for couple of years, but strictly using functional programming paradigms — I just started using object-oriented paradigms a few days ago, and want some advice on how ...
1
vote
0answers
29 views

Copy / paste special excel row

This is part of Invoice. If I have 20 items of it I need to copy nth row (because end user set format only on few cells in nth row) so to keep it formated I need to copy entire row and paste it ...
2
votes
0answers
272 views

Passing a form reference for accessing control in other class

I have a form and one other class that basically maintains initialization state of the form (in this case, loading data from Json file to controls in form). My form code: ...
5
votes
2answers
2k views

Create URL query string from dictionary

I have a dictionary of parameters and value, and the function creates a URL query string from it: ...
0
votes
1answer
70 views

Simple property formatting

In a VB.Net class, I have an method that replaces all square brackets [] in certain properties by normal brackets (). Edit: The ...
2
votes
2answers
83 views

How to avoid code duplication in ordering system

Here is the piece of order system. And this is hierarchy of order classes in this system ...
2
votes
1answer
126 views

Marshaling to a complex structure in .net

This is a follow up from question https://stackoverflow.com/questions/45106245/net-file-random-access-recoard-locking I have been able to make the reading and marshalling work ok but the performance ...
2
votes
0answers
56 views

Updating Excel sheet with information from a DataTable

Basically, I'm trying to update an excel sheet using a DataTable (The columns structure between the two are not the same) with respect to the following rules: ...
2
votes
1answer
120 views

Numbers to words

A bit of code I made in VB.NET to convert the digit form of integers into words. I've intentionally assumed that inputs will match the desired format since the focus of this task for me was to ...
4
votes
1answer
177 views

Abelian sandpile

I am trying to programm the Abelian sandpile model in VisualBasic. Also, here is a youtube video made by Numberphile about the very same topic. Here is a picture (\$2^{20}\$ grains of sand) I made ...
0
votes
1answer
17 views

Padded Version.ToString() extension

I want to convert a Version object to a string, but with the parts padded to a given width. E.g. 0.22.1 with parts padded to a ...
1
vote
1answer
57 views

Read date from a file and rename two files using the date

Problem I have image files that are RAW data and have the extension .NEF Whatever edits I make to these files are stored in what is called a sidecar file with the ...
1
vote
1answer
70 views

Recursive function to merge 3D objects

I have several 3D items in listOri. For this example: listOri has A,B,C,D,E. A overlaps with C. B overlaps with D. D overlaps with E. I have a recursive ...
1
vote
1answer
48 views

SQL subquery to determine whether or not a particular row is the first item that matches the subquery

Here is my VB.NET and SQL query (which is one of the things I'm particularly interested in having critiqued): ...
2
votes
0answers
74 views

LightsOut - A homework framework for teaching CS to non-engineers

This provides a fill-in-the-blanks homework framework to implement the game "LightsOut". LightsOut is a game with a grid of lights. When you touch a light, it toggles it’s state; it ALSO toggles the ...
1
vote
1answer
66 views

Optimize Arraylist function call

I am using the following to retrieve some user info based on IP address. ClientLocation() returns an array with city, state and coordinates. My concern with this ...
1
vote
0answers
206 views

Optimizing Levenshtein Distance with nested loop

Brief illustration: I have 2 classes - tbCustomer and tbDHN which is stored inside a list....
6
votes
1answer
2k views

AES encryption/decryption using pure .NET and streams

I'm trying my hand at simple encryption and decryption. Ideally I'd like to be doing it the 'right' way, ie something secure without doing it in a way that will have a serious hole. I'd prefer to do ...
1
vote
2answers
565 views

Find and display the position of a word in a sentence

How can I simplify this code: ...
2
votes
1answer
292 views

LinQ wrapper to get distinct items from a IEnumerable based on a function of item

I often need to perform LinQ queries to get distinct items from a IEnumerable based on one of its properties. I would like to know if this is a good way to wrap this operation: ...
6
votes
2answers
200 views

Using/reusing the SQL Command for several Inserts in the SQL Transaction

I'm using the code below to save a record in my database. I was thinking that I am creating new instances of the SQL Command object and fear that I might be bloating the system memory and not doing ...
2
votes
0answers
919 views

Find and replace text inside text boxes in MS Word

I have this procedure to realise a find and replace on a word document. Since I have text boxes, using this way to do this is a bit a slower than what I'd like it to be, if it were just text on a ...
2
votes
0answers
53 views

Requesting information about people from a web API

I'm requesting from a web API information about 20,000 people that I need to update continuously at lightning speed (the web server doesn't throttle the number of requests). I can request an update on ...
4
votes
2answers
156 views

Setting fields, with default values, before saving a row

I would like to find out if there's a cleaner way to go about validating input before it goes into a function. What I'm doing seems like a lot of code, I'm sure there's a better way. I would also ...
3
votes
1answer
91 views

Finding black and white images

I am looking to speed up the search for black and white images. I have about 150,000 images that I need to check but this is taking so long. How can I speed up the code? ...
2
votes
0answers
43 views

Creating an Excel sheet and appending namings for a matrix

I'm working on some VB.Net code to generate data sheets for giving user rights on a per folder level. I came up with this code but it's very slow and I feel like it could be improved. ...
4
votes
1answer
581 views

Display factorial with user-entered number

This needs some optimizing without any additional variables or loops. The difficult part of the task was no additional variables subroutines/functions or loops. If that seems (near) impossible then ...
1
vote
1answer
66 views

Database Dynamic Table Creation

The code below is meant to build an array with certain properties neccesairy to create column for a table in a database. Would there be any more effcient way of doing this? ...
4
votes
2answers
732 views

Evaluate a game of tic-tac-toe to determine winner

So the program will take input of a series of 9 integers which indicate which square was played on each move. Player 1 is always X and player 2 is always ...
7
votes
3answers
448 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 (...
0
votes
1answer
196 views

Security check using an SQL call

In our latest Veracode scan for an application, I have come across the issue of Improper Resource Shutdown or Release. It is pointing at a function. Here's what the code looks like: ...
3
votes
2answers
80 views

Parsing and extracting all IDs from a document (using regex with capture)

I'm interested in parsing and extracting the IDs found in a document. The IDs are found throughout the document in the this format: IDStart=1FG3392MQ9&IDEnd The "1FG3392MQ9" is an example of ...

1
2
3 4 5
7