Visual Basic.NET





Visual Basic .NET (VB.NET) is an object-oriented programming language implemented on the .NET framework, but also supported on other platforms such as Mono and Silverlight. Microsoft launched VB.NET as the successor to the Visual Basic language. Though it is similar in syntax to  Visual Basic pre-2002, it is not the same technology,

Share tech news, updates, or what's on your mind.

Sign up to Post

Using VB.NET I am filling in a one <input> element.  That element isn't part of a form... it is part of Ajax.

Upon entering text into the input element and hitting the Enter key Ajax posts the contents of the form to another page.

How can I do this using VB.NET.

If the data that I am entering into the input element is appending with Chr(13) or Chr(10) this doesn't help.
Become a Certified Penetration Testing Engineer
LVL 13
Become a Certified Penetration Testing Engineer

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

The code below works, but I don't need it to be long data.
I've tried replacing the "LONGTEXT" with "SHORTTEXT" but that just gave me an string error.

If strBomPartCount.Length > uintTableCurrentColumnCount Then
                For columnIndex = uintOffSet To strBomPartCount.Length
                    oQuery = "ALTER TABLE PcbBom ADD COLUMN PnQty" & (columnIndex - 4) & " LONGTEXT"
                    oComm = New OleDbCommand(oQuery, oConn)

            End If

Thanks in advance.
I want to select a row from a table and present
that row in a web Form which is developed using the row columns?

I am developing a table which will consist of form data which will be presented
based on a given type.

How can i convert a OPUS audio file to a .wav file in VB (or C@) - possibly using NAudio?
How can I convert a (Base 64) UTF16 string to a standard string  in vb (or C#)
Given this information...
POST /Sale/Application/v2/mypage.asmx HTTP/1.1
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: ""

Open in new window

How would I post my xml data to a service in web page win 4.5 environment

I do NOT want to import the wsdl
I've written a VB.NET desktop application.

The main form appears wider on a W7 machine than W10.

How can I fix this?  Using a tape measure I see that the W7 machine displays the form about 1" wider.
Hi Experts,

In VBA, I am having trouble formatting a date/time into this UTC format like this: 2018-03-11T00:01:00Z

Please help...

I have a few user settings in my project. The problem I am having is that they are not updating when I save them. The settings are set in user in the project properties. My code is:

        My.Settings.ServerIPAddress = txtServerAddress.Text
        My.Settings.ServerUserName = txtServerUser.Text
        My.Settings.ServerPassword = EncodeServerData(txtServerPassword.Text)

The problem is in the following:

            If My.Settings.UpdateSettings = True Then
            End If

I use this so that when a new version is installed I get the old settings. I need the best of both worlds the user to be able to change the settings and them being preserved when new versions are installed.

Any help would be appreciated

I developed a small program to learn how to implement different functionality before I create the bigger (full blown) program.  One of the things I've created is a user defined control with three checkboxes, and a custom property and event.  The main form has only two controls that aren't buttons, the user defined control and a textbox, each one bound to a field of a datatable.  I'm using the SQLDataAdapter's update method to update changes to the local datatable back to the SQL Server table.  I've seen that for any data row I've been on and traversed from to another row, the RowState is "16" which means "Modified", even if I didn't make any changes to it.  If I change a checkbox in the user defined control, it gets saved to the local datatable successfully.  I know this because the same checkbox is checked when I move from that row and back to it.  Also, any time I change the textbox contents it saves properly back to the SQL database when I invoke the update method on the data adapter.  However, the field bound to the usercontrol doesn't always update back to the SQL Server table.  For whatever reason, it seems to update successfully only when I click the "Next" button several times to transverse through the rows of the local datatable before issuing the update.  Why, is the field bound to the usercontrol not updating unless I traverse through several records before issuing the update?

Imports System.Data.SqlClient
Public Class Form1

    Dim dap1 As 

Open in new window

C++ 11 Fundamentals
LVL 13
C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.


I have an rdlc report in Legal papersize. I have set the report properties to Legal. The problem I am having is when I load it in to the reportviewer  and go to print the pagesize under page setup is always set to letter so it has to be changed manually. I need to be able to set the page settings in reportviewer programmatically so I can switch between letter and legal sizes via the code.  I have tried various things but nothing seems to affect the page setup dialog. What is the correct procedure to do this. I am coding in


Hello EE,

Im trying to do this linq query :

            Dim qx = (From m In MyItems
                         Where arrString.All(Function(v) m.Value.Contains(v))
                         Let row = rowID
                         Let myKey = m.Key
                         Let myValue = m.Value
                     ).OrderBy(Function(n) n.myKey) _
                      .Select(Function(t) New With {t.row, t.myKey, t.myValue})

Open in new window

it does not stops while running my software, but if I place a breakpoint, and I try to see whats inside "qx", it says : Error Type expected"

the goal is to return 3 variables, (Row, myKey, myValue),  thats why I cannot do  .ToDictionnary() or .ToList()  I thought I needed to do Select New With since I have more than 2 varaibles

also I wanted to OrderBy in my LINQ
do you see any problem looking at it ?

I am trying to open the default mail app (Outlook in my case) on the client side from a web based application written in

In the local application it works fine using for a basic example:
Import System.Diagnostics

Open in new window

However, the web application appears to be trying to run on the server side rather than the client side. Does anyone know a way around this to allow it to open the mail app for a user?

Note: I am able to send emails automatically via the SMTP server but I would like the user to see the contents first so would like to open in an email client.

Hi Experts,

I've got a VB6 application (I am the author) that is crashing without a trace of anything, except a .dmp file (attached).
It crashes when running in the VB6 IDE or as a compiled .exe.

The only error message I can see is:

The thread tried to read from or write to a virtual address for which it does not have the appropriate access.
Heap Information:      Not Present

Here's the whole Dump Summary (opened in VS 2013):

Dump Summary
Dump File:	HIPAVE.exe.6656.dmp : C:\Users\Leigh\AppData\Local\CrashDumps\HIPAVE.exe.6656.dmp
Last Write Time:	4/03/2019 1:20:56 PM
Process Name:	HIPAVE.exe : D:\Dev-Ver5.0\HIPAVE50\vb6\HIPAVE.exe
Process Architecture:	x86
Exception Code:	0xC0000005
Exception Information:	The thread tried to read from or write to a virtual address for which it does not have the appropriate access.
Heap Information:	Not Present

System Information
OS Version:	10.0.17134
CLR Version(s):	

Module Name	Module Path	Module Version
-----------	-----------	--------------
HIPAVE.exe	D:\Dev-Ver5.0\HIPAVE50\vb6\HIPAVE.exe
ntdll.dll	C:\Windows\System32\ntdll.dll	10.0.17134.556
kernel32.dll	C:\Windows\System32\kernel32.dll	10.0.17134.556
KERNELBASE.dll	C:\Windows\System32\KERNELBASE.dll	10.0.17134.556
msvbvm60.dll	C:\Windows\System32\msvbvm60.dll
user32.dll	C:\Windows\System32\user32.dll	10.0.17134.376
win32u.dll	C:\Windows\System32\win32u.dll	10.0.17134.1

Open in new window


I have an DropDownList in which I want to show  a list regions and the code that applies to that region.
The user will only see the list of regions. My code will automatically find the code attached to that region.

Is this what a DropDownList Value and Text are for. How would I load the DropDownList so each item stores the Region and Code?
Then how would I gather the code based on the region selected?

Please explain .NET Standard 2.0 and open source.

and how code reuse is enhanced by giving me an example or two of how this is a benefit. For example, a library that can be re-used between various platforms.

And is .NET Standard 2.0 a part of the open sourcing of the .NET Framework? Or is it MVC that is open sourced?
What are the recent enhancements to the .NET Framework since 4.5?

What is the current latest released version? Are there any reasons to NOT use this latest version on a new .NET Framework MVC project?

So, what are the big updates since 4.5? And when was 4.5 released?

What top .NET Technologies for .NET Technical Lead Role?

I am brushing up on various .NET Technologies to fill a  .NET Technical Lead Role which will involve not only various technology choices, but mainly the communication with a global team of developers who need to implement these technologies.

So, please provide me a list of .NET Technologies which I should prioritize as I spend the next few weeks ramping up.

I may also be looked at to assemble a list of coding standards (coding do's and don't's), then to use code reviews, pull requests, etc. to help communicate those coding standards to a team, some of which may be an offshore and on a different timezone.

So, can you start with a short list of .NET technologies that can prime the pump and get my juices flowing again with these topics, most (or all) I have worked with previously in some capacity.

How to remove all characters from a string and then add a prefix of 0 to the result.
Str= HJY98


Become a Microsoft Certified Solutions Expert
LVL 13
Become a Microsoft Certified Solutions Expert

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

I have a text box that I want to fill in code behind with an sqldatasource defined in client side.  How to I use this data source in code behind to fill one data point in the text box.  Below is my code.

Thanks in advance for the help.

<asp:SqlDataSource ID="Die_PtDscDataSource11" runat="server" ConnectionString="<%$ ConnectionStrings:...ions %>"
                                                    ProviderName="<%$ ConnectionStrings:ASTJV...finitions.ProviderName %>"
                                                    SelectCommand="SELECT DieNumber, PartDescription FROM METRICS WHERE Department=@Department AND PartNumber=@PartNumber">
                                                        <asp:ControlParameter ControlID="DeptDrpDn11" Type="String" />
                                                        <asp:ControlParameter ControlID="PrtNoDrpDn11" Type="String" />
Hello EE,

I need to count the days intervals in a dictionnary Of(Date, String)

so if row 1 is :     12/01/01/2019,  ABC
row 2 is :   12/01/15/2019, XYZ
row 3 is : 12/02/22/2019, MNP

I need to have results like this somehow:  

15 days
38 days

so there is 15 days interval between row1 and row2 and there is 38 days between dates of row and row 3  (we need also to take into account the 30/31/28 ending days of months)

how can I do that!? Any efficiant ways with LINQ maybe ?
Is there a way in to play in real time a sound that is being recorded.
Find the third character in the string and check whether it is - (hyphen)

I am using desktop.
A windows update has put paid to my VB6 installation, so I am blundering about trying convert a project to VB.NET
This code
        Dim ch As ColumnHeader

        With ListView1
            ch = .ColumnHeaderCollection.Add("Letter", 1500)
            ch = .ColumnHeaderCollection.Add("Vol Name", 1500)
            ch = .ColumnHeaderCollection.Add("Type", 1500)

Open in new window

gives this error on the last three lines.

Error      BC30469      Reference to a non-shared member requires an object reference.      

I have no idea what is supposed to be shared.

Googling shows some answers, but they all seem to refer to user-written classes, not standard controls.
I am trying to post form field data from a page. The form filed is an textbox control. I am trying to do the following:

1. Enter a value in the form.
2. Click the submit button.
3. Return the results in a Gridview control or even a Detail view.

This is a simple webform page. I am doing this in I am trying to avoid doing this programmatically in the Code Behind page and I know it can be done but I am missing something. I created the SQLDataSource and when I test it there it brings back results. I can even pass a url string value and get results. I believe I have forgotten how to do this with form field values. Do I need to place something in the code behind? It seems I am missing something simple. Here is my code below:

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="2posted.aspx.vb" Inherits="_2posted" %>

<!DOCTYPE html>

<html xmlns="">
<head runat="server">
    <form id="form1" runat="server">
                       <asp:TextBox ID="search" runat="server"></asp:TextBox>    

                    <asp:Button ID="Button1" runat="server" Text="Button" PostBackUrl="~/2posted.aspx" />  

           <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1">

Visual Basic.NET





Visual Basic .NET (VB.NET) is an object-oriented programming language implemented on the .NET framework, but also supported on other platforms such as Mono and Silverlight. Microsoft launched VB.NET as the successor to the Visual Basic language. Though it is similar in syntax to  Visual Basic pre-2002, it is not the same technology,