Dim arLines() As String = .Lines '// get all lines into a String.Array.
arLines(2) = "line.3 has been updated" '// update selected line.
.Lines = arLines '// add lines back to TextBox.
When you count lines or anything by using .Count or .Length, it starts at 1 then 2,3,4,etc.
When you use an Index, it starts at 0 Not 1, and it goes as 0,1,2,3,etc.
.this is the reason you might have/will notice the "-1"'s when working with .Items and Indexes.
You should always check if the line you would like to edit is there for you to edit.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
changeLineInCoolTextBox(0, ">>>>>>>>>") '// first line.
changeLineInCoolTextBox(TextBox1.Lines.Length - 1, "<<<<<<<<<") '// last line.
Private Sub changeLineInCoolTextBox(ByVal iCoolLineIndex As Integer, ByVal selContentToReplaceCoolLineWith As String)
If Not iCoolLineIndex > TextBox1.Lines.Length - 1 Then '// check if the line you would like to replace exists in TextBox.
Dim lines() As String = TextBox1.Lines
lines(iCoolLineIndex) = selContentToReplaceCoolLineWith
TextBox1.Text = Join(lines, vbCrLf)
MsgBox("index was outside the bounds of the cool array, since it is greater(in this case) than the TextBox.Lines", MsgBoxStyle.Critical)
Hi I'm having a problem implementing a mini shopping cart drop down in the header to show the user all the products they have in their shopping cart. It seems the only solution for this is Ajax, and I've looked all over and can't find anything that I could possibly ...
Help! I want to create a java program that finds the highest even integer among the values entered by the user. Stop asking values when a value less than 1 have been entered. If no even integer is entered, display "No Even Integer"