How can I delete an item from an array in VB.NET?

As Heinzi said, an array has a fixed size. In order to ‘remove an item’ or ‘resize’ it, you’ll have to create a new array with the desired size and copy the items you need as appropriate. Here’s code to remove an item from an array: <System.Runtime.CompilerServices.Extension()> _ Function RemoveAt(Of T)(ByVal arr As T(), ByVal … Read more

VB.NET Function Return

The difference is that they DO DIFFERENT THINGS! ‘Return value’ does 2 things: 1. It sets the function return value at that point 2. It immediately exits the function No further code in the function executes! ‘Functionname = value’ does 1 thing: 1. It sets the function return value at that point Other code in … Read more

x=x+1 vs. x +=1

From the MSDN library for +=: Using this operator is almost the same as specifying result = result + expression, except that result is only evaluated once. So they are not identical and that is why x += 1 will be more efficient. Update: I just noticed that my MSDN Library link was to the … Read more

Why does a VB.Net function that returns string only actually return a single character?

Note: this answer was originally written by the OP, Kibbee, as a self-answer. However, it was written in the body of the question, not as an actual separate answer. Since the OP has refused repeated requests by other users, including a moderator, to repost in accordance with site rules, I’m reposting it myself. After trying … Read more

how to add new rows into a datatable vb.net

Here is an example of adding a new row to a datatable that uses AutoIncrement on the first column: Define the table structure: Dim dt As New DataTable dt.Columns.Add(“ID”) dt.Columns.Add(“Name”) dt.Columns(0).AutoIncrement = True Add a New row: Dim R As DataRow = dt.NewRow R(“Name”) = txtName.Text dt.Rows.Add(R) DataGridView1.DataSource = dt

Why is it not necessary to indicate ByVal/ByRef anymore?

It seems that this post covers your question: http://msmvps.com/blogs/carlosq/archive/2011/03/15/vs-2010-sp1-changing-quot-byval-quot-vb-net-code-editor-experience.aspx So no, there is no way to get the old behaviour. From now on ByVal is the default (what it was before) and it won’t get added automatically to the method parameters. In my opinion this is a good decision since it’s making VB.NET a bit … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)