Questions tagged [vb.net]

Visual Basic .NET is a .NET oriented-object implementation and evolution of Visual Basic developed by Microsoft.

Filter by
Sorted by
Tagged with
1 vote
1 answer
161 views

Newbie: OOP working with different class-datatypes and loop through them

I'm relatively new to OOP. Let's say I have three different objects/classes defined, like: Public Class Part Private m_Name As String = "" Public Property Name() As String ...
0 votes
0 answers
52 views

What's a suitable pattern for handling multiple versions of PDF layouts?

I have a class responsible for generating a PDF. The class takes an existing PDF template and builds multiple pages. Each page has various elements that are inserted/manipulated. I now need to handle ...
-1 votes
1 answer
35 views

Are good practice to use SKPointI as key for dictionary

In my application I using SKPoinI as a key to store some small objects in Dictionary. SkiaSharp already used in this project for drawing and not need to be referred to only to allow SKPointI to be ...
0 votes
0 answers
316 views

Structuring a "Large" Windows Forms Project and Solution To something with Multiple Sub-Projects

I've willingly inherited a VB.Net forms project based on .Net 3.5 last edited with VS2012. I was able to open it up and up-convert it to VS2017. I can compile and run it and make some little tweaks. ...
  • 379
1 vote
3 answers
926 views

How should I name output variables that are the same as the function?

What are some conventions for naming a variable in cases where the name of the variable ought to be identical to the name of the function? I'm using VB.Net. I often have this problem when writing ...
27 votes
5 answers
7k views

When conversion from Integer to Single may lose precision

I was reading an article from Microsoft regarding Widening Conversions and Option Strict On when I got to the part The following conversions may lose precision: Integer to Single Long ...
1 vote
3 answers
2k views

What is difference between assigning to auto-Implemented properties VS their backing fields within the class

Before I started using auto-implemented properties, I was taught that when assigning properties in the constructor (because of the potential of making a property read only), I should assign directly ...
  • 147
0 votes
3 answers
489 views

Duplicated formula in front and back end

I'm struggling with logic that is duplicated in the front end code and the database. Right now, I just put a comment. Here is a small example (the current system has a lot of much more complicated ...
  • 153
0 votes
0 answers
277 views

Integration Testing a dynamic backend

Our company creates financial software that integrates into a banking system backend. We're running into a lot of problems making changes to it without seemingly impacting another customer or another ...
  • 2,343
0 votes
1 answer
817 views

Round robin, balanced home/away, multiple locations with multi-team options

This is my first question on this forum, have tried to exhaust every possible research option I could think of or find. Actually this is the first time I've posted for help with this anywhere, so ...
4 votes
0 answers
1k views

Passive View (MVP design pattern) with multiple Views

Coming up to speed on the MVP design pattern and I have a gap in my understanding. The consensus seems to be to design a 1:1 relationship between Presenter and View. This makes sense -- but how would ...
3 votes
5 answers
3k views

Convert a team from VB.Net to C#.Net

I am currently running a team of 5 VB.Net developers and have decided to make a switch to C#. The team builds and maintains around 20 different applications that run our whole platform, so the code-...
0 votes
1 answer
63 views

How to handle events in extended classes?

When one extends a class, how is the proper way of setting code to be executed upon some event of the base class? Should one handle the base class event this way: Public Class Class2 Inherits ...
  • 111
1 vote
1 answer
556 views

How should I load and change settings?

Please forgive me if my thought process is incorrect. I'm only a programmer in my spare time, with no formal training. I'm using VB.net to create a very basic application, but some settings need to ...
0 votes
3 answers
3k views

Is a singleton with an update method and software state verification a valid pattern?

Stack overflow suggested that this question my be better suited here. I normally work in c#, but I'm working in a vb.net net application currently. So feel free to respond with vb.Net or c#... ...
1 vote
1 answer
969 views

How should I protect the data sent over a tcp socket?

I have two applications. The client application is written in .NET and the server application is written in native C++. I am using TCP sockets for data communication between the two applications. ...
0 votes
3 answers
8k views

Best way to query data from database and then modify it

I'm working on a software using VB.Net which retrieves string packets through a TCP socket. The problem is it receives hundreds of packets per second. For each incoming packet the software should ...
1 vote
2 answers
214 views

Visual Basic Writing to File with Numbered Lines

This is more of a design/user experience kind of question, so if it belongs somewhere else please let me know. I have a program that has multiple PictureBoxes: PictureBox1 PictureBox2 . . ...
  • 123
1 vote
4 answers
1k views

How do I elegantly store tabular data in code?

Let's say I want to store date which cannot be changed by the user in code. For example, my application supports ten types of reports, and I want to store metadata about it. Usually, I'd use a ...
  • 9,596
1 vote
1 answer
73 views

Encapsulate common application libraries into a single library project

My company is planning to integrate 3 in-house libraries into all of our applications (with possibly more on the way), and I'm wondering what the best way to go about this would be. My initial ...
  • 273
2 votes
4 answers
677 views

Do I really need to stop the timers that do nothing?

I have a sample code here: Dim a As Boolean = False Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick If a = True Then Console.WriteLine("Example of a task ...
2 votes
1 answer
2k views

Standard way to call virtual method

So recently I was working on a project where I had a base class that provided some common functionality. It had several virtual (overridable in vb) functions. I noticed that some of these methods ...
  • 243
1 vote
1 answer
595 views

How to map references in different VB.Net solutions

I just come to a small company. There are more than 500 solutions in different VS.Net versions and even VB 6.0 projects. They share several dll. Is there a way to map relation between each program? ...
  • 113
1 vote
2 answers
4k views

Iterate over Collection while removing elements from it

I am iterating over a collection and want to delete some entries of it. Example: For i = 0 To Node.Nodes.Count If i >= args.TotalNumberOfNodes Then Node.Nodes.RemoveAt(i) End If ...
  • 161
3 votes
3 answers
1k views

C#/VB struct – how to avoid case with zero default values, which is considered invalid for given structure?

How to implement some constrained .NET struct/structure (let's say LimitedString), where its state with default values (set by CLR to technical defaults, i.e. nulls, zeros, etc.) should be prohibited ...
  • 662
4 votes
1 answer
2k views

Can an object contain a property that is another object?

I am new in the object oriented world. I am interested on learn the foundations of object oriented programming independently of any language. But for the moment I am doing the implementation on VB.NET....
3 votes
1 answer
416 views

“Best Practices” when designing large applications with multiple functions

A little background first. I have been tasked with rewriting our gun software into VB.Net (converting the code from BBJ). This software incorporates many different inventory management functions, such ...
16 votes
6 answers
1k views

Methods of debugging code (Nightmare situation)

I am frequently tasked with debugging an application at my job. It is a BI Application that we deploy to businesses, which includes a test environment, and a production environment. I am wondering if ...
  • 2,343
8 votes
2 answers
382 views

Is it OK to have a property of type COM object

I am developing a COM addin for Microsoft Excel, using VB.Net. I wrote a class to represent a worksheet that contains certain elements. Let's say for example it has a ListObject. I create a property ...
1 vote
1 answer
674 views

How can regular expression be ambiguous?

I am recoqnizing this pattern <.*> From string <a href="hello world">Hi Baby</a> Now, there are several match <a href="hello world"> is a match <a href="hello world"&...
  • 709
81 votes
4 answers
44k views

Should we include the NuGet PACKAGE folder in version control?

In a C# or VB.NET project, should we include the PACKAGE folder (NuGet package folder that is created in the root of my project that contains the nupkg files and other content) to our source control ...
2 votes
4 answers
554 views

Alternative way to expose you're returning Nothing in a method

I'm kind of in an impasse here. Lets say I have module A which exposes some methods returning objets and module B that uses said methods from Module A. Module A will have situations when it will have ...
0 votes
2 answers
3k views

Refactoring method with nested loops and 6 variables [duplicate]

I have a method which implements a small section of a (complex) algorithm. This algorithm has taken me several weeks to perfect and is by far the fastest method I can find. The method in question has ...
  • 135
2 votes
1 answer
586 views

Exception to the 'Nested types should not be visible' rule?

Is the following an acceptable breach of the 'Nested types should not be visible' (Microsoft .NET code analysis CA1034) rule? I have a have a class, let's call it 'TandAOLL', this is tree and an ...
  • 135
1 vote
0 answers
78 views

Metrics for when to use a hash value?

I am working on a project that requires a series of flat files. I will be doing some data checking against simple date like: ID;StatusCode So a typical file might be like: 13993;R 38293;A 19349;I ...
0 votes
2 answers
1k views

How to avoid using service location when using dependency injection? [closed]

I am trying to use dependency injection in a WPF application, and I really can't figure how to avoid using service location, which is considered to be an anti-pattern in many articles. I am using the ...
  • 111
4 votes
2 answers
3k views

Handling exceptions in a loop without breaking the loop (try to process all members)

Scenario: I have a loop that iterates over an Array of COM objects and does some work using them. My fear, working with COM objects, is that some exception will creep up (possibly on another user's ...
  • 269
-1 votes
2 answers
310 views

Should client side have a log? [closed]

The client side of my application is written in VB.Net, it accesses a java server. Server logs every request that was made by client, client shows every exception to the user (with an option to send ...
  • 109
6 votes
2 answers
2k views

Is it acceptable to define a "module" and "class" within a single .VB element?

Experiment: I have found it is possible to define both a "Module" (Namespace?) and a "Class" (Namespace?) within a single .Vb element (Module??). You can try this at home: Create ...
  • 269
2 votes
1 answer
123 views

Parsing XML to two separate (WInForm) controls

I've spent a great deal of time researching a solution to my issue with very little success. I'm rather new with .NET and vb.net so I apologize if this seems simple to anyone else. I had a first ...
6 votes
3 answers
5k views

Saving to Registry vs. CustomFile [closed]

I've been using the usual My.Settings... method when it came to saving settings for my program but I was just wondering, If I wanted to save program settings into the Registry and load those settings, ...
  • 185
2 votes
2 answers
844 views

When to turn off Option Strict? Or how to deal with inheritance of COM using Option Strict?

I'm trying develop an add-in for an application using it's API and I have Option Strict turned on. Trying to work with these COM objects is causing multiple compile issues saying Option Strict On ...
  • 269
1 vote
2 answers
3k views

DLL or web service for common functions?

We have a variety of basic functions (date utilities, email sending, internal math calculations, etc) that are currently in an old VB.NET project. We're going to move towards C# and I'm wondering if ...
0 votes
0 answers
429 views

How to model dynamic table schema in .Net code

I am preparing to do an upgrade of a fairly large program that is currently written entirely in MS Access, both GUI and data (code and data in separate files). One of the key features of the product ...
  • 111
0 votes
3 answers
758 views

Understanding VB.NET variable scope

What's the difference between this code snippet: Sub Test() Dim i as Integer = 0 Dim q as String = "" While i<10 q=String.Format("Some text {0}", i) Console.WriteLn(q) i=i+1 ...
  • 31
0 votes
1 answer
666 views

proper exception handling (throwing/message) dll libary

I just wrote a dll library using vb.net. while testing, i got an error which i did not initially use a try-catch block. The code is Try 'The first four bytes are for the Command ...
  • 643
3 votes
1 answer
200 views

How to design similar purpose static methods

I know that you cannot override static functions, but for what I'm looking to do, it seems like the logical way to design my class. I have a method that is associated with my abstract class, that i ...
3 votes
3 answers
2k views

Is it bad practice to register assemblies in the GAC?

I have moved a few assemblies to the Global Assembly Cache because they are used by multiple applications i.e. a VB.NET app and an ASP.NET app. I remember a few years ago when I started in my current ...
  • 6,963
1 vote
1 answer
3k views

.NET WCF: Persistent connection or Open/Close as needed?

I have a .NET WCF web service currently running in production right now. I would say 95% of the time it works flawlessly and as intended. However; there are times when I am throwing an exception that ...
  • 113
3 votes
2 answers
911 views

An algorithm that spreads similar items across a list

I need an algorithm that distributes same items across a list, so maximizing the distance between occurrences. E.g. I have a list of 15 items: {a,b,c,c,c,d,e,f,f,f,g,h,h,i,j} The algorithm should ...