140,150 questions
0
votes
0
answers
17
views
ASP.NET WebForms: Adding StaticFileModule Rule for XML Causes “Duplicate Entry” Error and Breaks Index.aspx
I’m running into a specific issue with my web.config when trying to serve XML files.
As soon as I add this rule:
<add name="XmlFile" path="*.xml" verb="GET,HEAD" ...
5
votes
1
answer
106
views
Word.Document Close ComException
We have some legacy code that late binds to Microsoft.Office.Interop.Word to do various things with documents.
This code has worked fine for years.
The Solution is written in VB.NET and consists of ...
Advice
0
votes
0
replies
18
views
SSRS Report External UNC Image File - If Not Found - Default Image
In my dataset for an SSRS report, I have a column that is comprised of a path and a file name of an image, dynamically created by each user's user id, as that's how the images for their pics are ...
3
votes
1
answer
94
views
Why does calling ToString give different results with a Double returned by CDbl and a Double returned by Double.Parse?
Demo code:
System.Console.WriteLine($"CDbl: {(CDbl("234.56"))} {(CDbl("234.56")).GetType} {(CDbl("234.56")).ToString("0.0")}")
...
Advice
0
votes
4
replies
110
views
VB.NET and classes and their sub-classes
I have a class in VB.NET. The definition of this class is re-defined according to need.
For example: TR as char(2), F1 as Char(10) then later TS as Char(2) F1 as float.
I want to define one class and ...
-1
votes
1
answer
111
views
How to get an existing RowVersion value from a table to be used when updating the same record?
I'm learning to update a record in a SQL Server table after checking for concurrency violation using a RowVersion column (timestamp data type). However, I'm not able to extract the existing RowVersion ...
0
votes
1
answer
93
views
Setting the focus in .ascx user controls
I am having some difficulty setting the focus inside an .ascx custom control. Microsoft Copilot advises me to place a txtName.Focus() or Page.SetFocus(txtName) inside the Page_Load event of the .ascx.
...
1866
votes
26
answers
2.5m
views
What is a NullReferenceException, and how do I fix it?
I have some code and when it executes, it throws a NullReferenceException, saying:
Object reference not set to an instance of an object.
What does this mean, and what can I do to fix this error?
0
votes
1
answer
90
views
DS-K1T320MFWX – SDK connects but fails to retrieve access events or users (VB.NET)
I'm working with a Hikvision DS-K1T320MFWX terminal and trying to integrate it using the official SDK downloaded from Hikvision's website. I'm developing in VB.NET, and the connection works fine: I ...
0
votes
1
answer
102
views
.NET Framework 4.8-targeted application is working fine in a machine which only have .NET Framework 4.7.2
I have an exe which is written using .NET Framework 4.8.
I have the following line in the vbproj file of the exe.
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.8&...
0
votes
2
answers
269
views
Can the TextBox portion of a ComboBox be made resizeable on all sides?
Can the TextBox portion of a ComboBox be made resizeable on all sides?
I've done this with the TextBox (shown below). I thought the ComboBox was a composite control with a TextBox & ListBox, so I ...
1583
votes
19
answers
630k
views
Why is Dictionary preferred over Hashtable in C#?
In most programming languages, dictionaries are preferred over hashtables.
What are the reasons behind that?
438
votes
47
answers
490k
views
Difference in months between two dates
How to calculate the difference in months between two dates in C#?
Is there is equivalent of VB's DateDiff() method in C#. I need to find difference in months between two dates that are years apart. ...
1
vote
1
answer
219
views
SupportedRuntime options in app.config for C# project that support <targetFrameworks> with multiple values
I'm migrating legacy C# / VB.NET applications to newer frameworks.
I moved project files from legacy project files (non-SDK) into modern SDK style. Now I also added net452 and net481 as options to ...
0
votes
0
answers
58
views
Marshal.GetActiveObject Fails with error code 0x800401E3
I am attempting to connect to SolidWorks via this code:
Dim swApp As SolidWorks.Interop.sldworks.ISldWorks = _
TryCast(System.Runtime.InteropServices.Marshal.GetActiveObject("SldWorks....
1
vote
2
answers
165
views
How to make shapes, drawn on a form, resilient to changes in display's resolution / scale
An elegant solution for drawing polygons on a form was proposed by Jimi, as part of an answer to the question Why am I getting an extra line when drawing polygons? (see attached code).
I designed the ...
0
votes
0
answers
96
views
How to set up 3 update panels
I have 3 panels and would like to use update panels as follows for better display. ASP.NET / VB.NET
Panel 1:
2 text boxes
2 drop down lists
Panel 2:
2 buttons
Panel 3:
3 drop down lists
1 checkbox
If ...
0
votes
1
answer
70
views
How to keep getting the latest validation code in google authenticator for TOTP
I am implementing 2 Factor Authentication TOTP (Time-based One-Time Password) for a login page. After enter id and password, it will go to TOTP checking. It can only get the first code and won't ...
1
vote
2
answers
99
views
Sorting a list of objects. Is it possible to use a property as parameter?
This is a simple class (Person) with a shared list (Persons). My question concerns the possibility of improving the code in the method SortByPropertyName. It works as it is but, it would more handy if ...
1
vote
0
answers
156
views
Stop PictureBox from resizing when Text sze is changed VB .net
Cannot insert the Code comes up with:-
"Your post appears to contain code that is not properly formatted as code. Please indent all code by 4 spaces using the code toolbar button or the CTRL+K ...
0
votes
0
answers
39
views
Error when using ExecuteNonQuery in SSIS Script task using OleDb connection in VS 2022
I have created an SSIS package to transfer a large bulk amount of data. Everything works fine on all my other Execute SQL Tasks, however on my only Script Task I keep getting the error
Invalid column ...
0
votes
2
answers
70
views
ASP.NET WebForms dropdown causes page to clear on selection change
I am currently working on an old WebForms application in VB.NET. I am supposed to add a dropdown to an existing page that has been working with all controls so far. This dropdown appears in the ...
948
votes
14
answers
612k
views
How to enable assembly bind failure logging (Fusion) in .NET
How do I enable assembly bind failure logging (Fusion) in .NET?
0
votes
2
answers
91
views
What is the difference between the two versions of OpenTextFileReader() in Visual Basic?
Visual Basic .Net has two versions of OpenTextFileReader(), as listed below:
Microsoft.VisualBasic.FileIO.FileSystem.OpenTextFileReader(String) As System.IO.StreamReader
Microsoft.VisualBasic....
-1
votes
1
answer
132
views
How do I reference controls with a variable in visual basic 2025?
I am trying to do the same sort of thing as the OP this question, but can't get the suggested code in the answer to work.
I'm using Visual Studio 2022, but doubt that's the reason it doesn't work for ...