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.

learn more… | top users | synonyms

0
votes
1answer
50 views

Inheritance doesn't seem right

Please take a look at the code below: Public Class ClassA Protected TestVariable1 As String Protected Sub DoSomethigImportant() End Sub End Class Public Class ClassB Inherits ...
1
vote
0answers
18 views

VB.NET | SQL Code Cleanup

I don't know how else to form this question. I am trying to teach myself a new language in three weeks. Can you please give me some advice on how to clean my code and make it faster or more reliable? ...
2
votes
1answer
47 views

Screen resolution

I am working with an application that will have sub forms. The primary form opens above the system tray, and on mouse-over, secondary windows will open right next to the primary. When I use the ...
0
votes
0answers
25 views

Generating permutation of string

I have written a code that generates all possible permutation with repetition of a string, I want to make shorter and much faster kind of this program but I don't know how to Btw, This is my code of ...
2
votes
2answers
63 views

Objects and instance variables in loops

Is there anything wrong with doing this: Public Class Form1 Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load For value As Integer = 0 To 1000000 ...
3
votes
1answer
163 views

asp.net (vb.net): handling of open database connection and calling shared function from web api

I'm working on an ASP.NET project using VB.NET that uses Dapper and the code as implemented so far runs fine with just me testing. In the example below, Dapper calls a stored proc. But my I am ...
1
vote
1answer
74 views

How do I shorten my code?

I currently have a huge code for regenerating some things in a game a made. The code is very big and I think it can be compressed but I don't know how to do it. This is the code Private Sub regen() ...
1
vote
2answers
60 views

.NET - multiple DLLs and one namespace

Please have a look at the code below: ClassLibrary1 has a structure as follows: Namespace com.app.test Public Class Class1 End Class End Namespace ClassLibrary2 has a structure as follows: ...
1
vote
1answer
55 views

Not = or <> preferable in VB.NET

In VB, I believe the following are equivalent: If Not x = y Then ... End If and If x <> y Then ... End If Am I wrong? Is there some scenario in which they are not equivalent? If so, what ...
3
votes
1answer
36 views

I was wondering if there was a better way to improve my XNA joystick code? (Vb. Net)

I'm on a high school robotics team and I'm trying to code a Xbox 360 controller so that it'll controller the motors with variable speed. So far it works alright, but where I'm quite the novice coder ...
2
votes
1answer
61 views

VB.Net interfacing with F# Euclidean Distance Algorithm

I testing F# code which calculates "nearness" of two N-dimensional points using a least square euclidean distance algorithm. The class library is written in F# and the calling will be from VB.NET. ...
1
vote
1answer
52 views

Creating a new item or updating an existing item

Something about my code just doesn't seem right. It feels cumbersome and not very logical. Could someone put me out of my misery and let me know that I wrote this bit ok? It's pretty simple, when ...
0
votes
0answers
27 views

Is this the correct way to expose a setting for a vb.net class library?

I define in the Settings Tab of a VB.Net class library some user scoped settings. I want to expose these settings to other projects that reference the class library. I chose to do this using a public ...
0
votes
1answer
111 views

Using Statement for OleDB - Is this overkill?

I am still trying to wrap my head around good programming practice and just wrote this routine to read in an Excel file and return all the sheets into a dataset: Public Shared Function ...
3
votes
2answers
156 views

Improving UI response times by threading, a better way?

Since I've started to use a computer, I hated everytime an application's UI stops responding for a while. However, there are some applications I see, that are doing their "heavy" jobs, yet the UI ...
1
vote
2answers
58 views

Mode of list of numbers - VB

I have an array of numbers created by the user, the array is sorted and I can find the Average, Median, Max, Min, Lowest -> Highest, Highest -> Lowest. Now I just need to find the mode. Here is the ...
1
vote
1answer
121 views

A faster implementation of AcceptChanges?

So I started wondering why it takes 3.5 seconds to AcceptChanges for one changed record in a large DataTable. I wrote another implementation of AcceptChanges (VB.NET) - Me is a DataTable here: Public ...
1
vote
1answer
64 views

Inherit SortedDictionary - Is this good programming practice?

Also posted on Stack Overflow As an example, suppose I had a large amount of data about a set of Restaurants for a large set of Dates in a database that I need to analyze / output to the user. So, ...
1
vote
0answers
205 views

Automate scanning from multiple scanners on the same computer using WIA and VB

I originally posted this question on stack overflow but someone suggested that I post it here so Here I am :) I'm the ultimate beginner in programming. I have some experience in php and vba, doing my ...
1
vote
1answer
86 views

Is My Data Access Leaking Connections?

Folks I have an N-Tiered ASP.Net Web Forms application which uses Enterprise Library 5.0 for data persistence. Recently I have noticed my application has been spitting out the following error ...
2
votes
1answer
45 views

Synchronous MMF Test

(This was originally posted at StackOverflow on 10/14 but I've copied it here per suggestion by @mikalai) I'm seeking some second opinions regarding the validity of my test. In a nutshell, I'm using ...
6
votes
2answers
179 views

How to optimize 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 Interop.Excel class and the workbook I'm importing to is very formula intensive. ...
4
votes
1answer
135 views

OOP: Need tips of my approach in .Net

I am looking for some different approaches to this following OOP scenario. Dim pb As Object = Nothing If radCars.Checked = True Then Dim productBase As ProductsBase(Of CarColumns) ...
2
votes
2answers
821 views

Writing a Data Access Layer

I am new to programming and have written this Data Access Layer. I am using this DAL in my projects. Now, I have a feeling that it is pathetic (when I wrote it, I was kind of happy). Do you guys also ...
4
votes
2answers
203 views

I have an encrypted file, how to remove a specific string from that file

I got a file with lots of ASCII characters. No extension, and has the Type Of file attribute 190000 File. I have many characters like L¿ö in the file however I required to remove lines from a word ...
2
votes
1answer
409 views

Method for populating ListViewSubItems

This is my current method for populating the sub-items of ListView controls. I like this method for two reasons... 1) I don't have to keep up with the display order of the columns. 2) If I enable ...
3
votes
0answers
191 views

Building an ASP.NET Menu Recursively - Needs Refactoring and Readability Improving

The following code builds an ASP.NET menu recursively from data in a database: Imports Microsoft.VisualBasic Public Class MenuBarHelper Public Shared Function GetMainMenu() As Menu Dim ...
3
votes
1answer
322 views

speeding up an algorithm that find patterns in a growing collection

I want to find a way to speed up this code. if you look at the condition of If calculated Then in the code below, this is what slowing down the code. While the code provided seem fast with Const ...
0
votes
1answer
170 views

VB.NET program stops operating without any errors thrown [closed]

I have key logger that I wrote myself and is a somewhat large piece of VB code that after say 20 minutes stops working. I've tried using Try Catch statements, but no errors are thrown. I can't seem to ...
1
vote
0answers
330 views

Datagrid not refreshing correctly with Async Ping VB .Net

I have an application coded in VB.NET that has a bunch of servers in a DataGridView and does a continuous asynchronous ping. If all the servers are up it refreshes great, but if one goes down and ...
4
votes
3answers
114 views

Rewrite 2 repeating With-blocks

Got the following piece of code: If boolFlag Then With offer.Person1 entity.Birthdate = .BirthDate entity.FirstName = .FirstGivenName ...
1
vote
1answer
1k views

attempt to calculate age in vb.net

I am working on an app where I have to calculate the age of a person. Inside of my age class I have a function that is designed to account for leap year. Is there anything I am missing or could ...
0
votes
1answer
698 views

vb.net code to load XML and csv files to datatables at startup

Here is some code that I put together for an app I am working on that loads 2 xml files and a large csv file to a dataset at startup. It runs fairly fast, but I would like a second opinion on what I ...
1
vote
2answers
146 views

Inheriting needed when only difference is performed in the constructor?

I have a class that produces a key based on the two objects passed. The key for the items passed is simply the string of the ID (a GUID) for each object. There is also a subclass that makes sure any ...
0
votes
1answer
348 views

vb.net general insert function

I am new to vb.net and one of the functions I wrote is below. The idea behind it is to just send a dictionary and table name to the function and get the result i din return. Is this good practice or ...
0
votes
1answer
259 views

Is there a prettier or more performant way to create an MVC Pager Helper?

I've got this MVC Pager Helper and it's working exactly as expected. I'm wondering if there's a prettier or more performant way to build this out? Also, I know that the StringBuilder might not be the ...
6
votes
0answers
318 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 ...
3
votes
3answers
829 views

Checking datasets for tables and rows

Is there a cleaner way of checking a dataset for tables/rows before attempting to read them? If ds.Tables.Count > 0 Then If ds.Tables(0).Rows.Count > 0 Then 'do something with the ...
2
votes
2answers
335 views

beginner's class inheritance question C# VB Visual Studio 2010

I understand the typical example of fruit as a base class and banana, orange, and pear as derived classes. But what about when there is only one property in common? Do you still use class ...
2
votes
1answer
565 views

ASP.NET account login system implemented via Masterpage and Panels

I have been tasked with implementing a secure account login system for a website's content management system. I have built a solution around an access masterpage that handles all account access ...
1
vote
3answers
1k views

Switching to another Form from the Project Startup Form and Back Again

My two areas of question are related and are slightly generic in that they beg for best practice information for my two code examples. Topic 1: Switching to Another Form from the Project Startup ...
1
vote
4answers
720 views

Calling stored procedure with `sqlCommand`

I have the following code as part of an sqlcommand which is calling a stored procedure: Dim groupObj If groupId = 0 Then groupObj = DBNull.Value Else groupObj = groupId End If Dim siteObj ...
4
votes
1answer
217 views

My program spikes from 100000K mem to 1000000K mem in a matter of minutes in my program in VB.net

I've created a program that uses System.Graphics to render a simple (small) 2D scene to the screen. The problem is, for some reason, it starts to quickly accumulate memory. In fact, it goes from ...
1
vote
0answers
141 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 EndInvoke methods. I've built a Web ...
2
votes
2answers
333 views

Should I label ByRef parameters in .net functions?

A handy pattern that I like to use: TryGetBlah(ByRef blah as BlahType) as Boolean It kills two birds with one stone. Test that blah exists Gets blah What I don't like is that when ...
1
vote
1answer
126 views

Is this a good way to optionally run some code on a background thread?

I'm attempting to keep this as DRY as possible; is this a good method to optionally run some code on a background thread depending on a configuration setting? This will primarily be called from an ...
1
vote
3answers
494 views

Case statement in multiple methods

My page contains: GridView1, GridView2, Button1, Button2, DropDownList1 I bind Gridviews to the table selected in dropdown like this: Dim results as DataTable Select Case ddl1.SelectedValue Case ...
5
votes
1answer
407 views

Threadpool, multithreaded task, is this good

I have developed a test app that works by getting webpages source and processing it. I have up to 100k URLs in queue and want to use a maximum of 25 threads, please help me check if the code is good ...
2
votes
1answer
225 views

multiple threaded program vb.net

i have this code that is suppose to work with at starting the minimum number of threads, say 5. when it starts the first five threads, it automatically replaces any thread that is finished making ...
3
votes
0answers
185 views

C in CRUD for silverlight, is this the simplest? easiest? method without any side effects?

The C in CRUD silverlight Create new silverlight business application “CRUD” Add ADO.NET Entity Data Model to CRUD.web Select the db, the tables, build the project Add Domain Service Class to ...

1 2