codeorder 197 Nearly a Posting Virtuoso

See if this helps.

Public Class Form1
    Public Const cFmtCurrency As String = "##,###,###" ' don't need decimal for the local China currency

    Private Sub setCoolHandlersForTextBoxes()
        For Each myCoolTextBox In New TextBox() {TextBox1, TextBox2, TextBox3}
            AddHandler myCoolTextBox.Validated, AddressOf _myCoolTextBoxes_Validated '// set the event to be handled by each TextBox.
        Next
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        setCoolHandlersForTextBoxes()
    End Sub

    Private Sub _myCoolTextBoxes_Validated(ByVal sender As Object, ByVal e As System.EventArgs)
        With CType(sender, TextBox)
            If Not .Text = "" AndAlso IsNumeric(.Text) Then .Text = CInt(.Text).ToString(cFmtCurrency) '// Format.
        End With
    End Sub
End Class

This link might also help.

codeorder 197 Nearly a Posting Virtuoso

If you are trying to get extract content from a webpage in a WebBrowser, use MsgBox(WebBrowser1.Document.Body.InnerHtml).

codeorder 197 Nearly a Posting Virtuoso

See if this helps.

Public Class Form1
    Private WithEvents tmrMain As New Timer With {.Interval = 2000, .Enabled = True}
    Private rnd As New Random

    Private Sub tmrMain_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles tmrMain.Tick
        Static r, g, b As Integer
        r = rnd.Next(0, 256) : g = rnd.Next(0, 256) : b = rnd.Next(0, 256)
        Me.BackColor = Color.FromArgb(r, g, b)
    End Sub
End Class
codeorder 197 Nearly a Posting Virtuoso

.i just went grasshopper and ran out the.door, thanks also.:)

codeorder 197 Nearly a Posting Virtuoso

Not a math.wiz, just hobbyist programmer, and am just wondering; How are the calculations added up to return those results?
.ex: "C=0.4857143", though how are you getting that value?

zhouy commented: comment is not important -1
codeorder 197 Nearly a Posting Virtuoso

use a Static inside your Sub.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click, Button2.Click, Button3.Click
        Static btnName As String = "" '// stores .Name of btn.
        With CType(sender, Button)
            If btnName = "" Then MsgBox(.Name) Else MsgBox("previous btn: " & btnName)
            btnName = .Name '// add value to your string "AFTER".
        End With
    End Sub
codeorder 197 Nearly a Posting Virtuoso

>>How on earth can you multiply strings together If all .Numeric, Then "why.Not?"

codeorder 197 Nearly a Posting Virtuoso

.line.14, include those values in parentheses: "Total pay: " & (txtHoursWorked.Text * lstHourlyRate.SelectedItem + txtHoursOvertime.Text * DoubleRate)) and it should work.

codeorder 197 Nearly a Posting Virtuoso

This is the LinkLabel.Form and Form1 is your login.Form.

Public Class Form2

    Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
        Me.Hide()
        With Form1
            .TextBox1.Clear() : .TextBox2.Clear() '// un/pw TextBoxes.
            .ShowDialog()
        End With
        Me.Close()
    End Sub
End Class
codeorder 197 Nearly a Posting Virtuoso

Set the "Shutdown mode:" in fileMenu/Project/your app's Properties, Application tab To "When last form closes".

codeorder 197 Nearly a Posting Virtuoso

>>yes it want support on this
See if this helps.:)

Imports System.IO
Public Class Form1
    Private myFile As String = "c:\test.txt"
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ListBox1.Items.AddRange(New String() {"1", "f1", "f2"})
    End Sub

    Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
        Static selCoolItem As String '// stores the .SelectedItem to verify against the previously .SelectedItem.
        With ListBox1
            If Not .SelectedIndex = -1 Then '// if itm selected.
                If Not selCoolItem = .SelectedItem Then '// check if same item as previously .SelectedItem, if one selected.
                    selCoolItem = .SelectedItem '// store .SelectedItem in String.
                    For Each itm As String In File.ReadAllLines(myFile) '// read File.Lines and...
                        If itm = selCoolItem Then Return '// ...Exit Sub w/less typing. ;)
                    Next
                    Dim w As New IO.StreamWriter(myFile, True) : w.WriteLine(selCoolItem) : w.Close() '// append to File.
                End If
            End If
        End With
    End Sub
End Class
gozo12 commented: Oh god :) . this is worked perfectly . THANKS YOU SO MUCH AGAIN +1
codeorder 197 Nearly a Posting Virtuoso

Issue solved since thread solved? or do you still need support on this?

codeorder 197 Nearly a Posting Virtuoso

Also, see if this helps.

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ListBox1.Items.AddRange(New String() {"1", "f1", "f2"})
    End Sub

    Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
        Static selCoolItem As String '// stores the .SelectedItem to verify against the previously .SelectedItem.
        With ListBox1
            If Not .SelectedIndex = -1 Then '// if itm selected.
                If Not selCoolItem = .SelectedItem Then '// check if same item as previously .SelectedItem, if one selected.
                    selCoolItem = .SelectedItem '// store .SelectedItem in String.
                    Dim w As New IO.StreamWriter("c:\test.txt", True) : w.WriteLine(selCoolItem) : w.Close() '// append to File.
                End If
            End If
        End With
    End Sub
End Class

If you don't want the same item to be added to the file, load File in an Array, loop thru all lines and if item found Then Exit the entire Sub with "Exit Sub". If not found, have the code to append to file just underneath your For/Next loop.

gozo12 commented: ITS REALLY WORKED :D THANKS YOU SO MUCH +1
codeorder 197 Nearly a Posting Virtuoso

See if this helps.

Public Class Form1
    Private WithEvents tmr As New Timer With {.Enabled = True} '// dynamic.Timer.

    Private Sub tmr_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles tmr.Tick
        Me.Text = ListBox1.TopIndex '// display the top visible item's Index.
    End Sub
End Class
codeorder 197 Nearly a Posting Virtuoso

Just wondering; do the lines have to be in the Button's.Click event or can they be in separate Subs?as:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        someCoolSub()
        someOtherCoolSub()
    End Sub
    Private Sub someCoolSub()
        MsgBox("someCoolSub")
    End Sub
    Private Sub someOtherCoolSub()
        MsgBox("someOtherCoolSub")
    End Sub

Reason I'm asking is because you can use the Threading.Thread.Sleep , although that will freeze your entire application for 5 seconds, not just pause the the time between running the rest of the lines of code.

codeorder 197 Nearly a Posting Virtuoso

See if this helps.

With DataGridView1
            Static iTopRow As Integer
            iTopRow = .FirstDisplayedScrollingRowIndex '// get Top row.
            Form2.ShowDialog()'// Form that edits record.
            .FirstDisplayedScrollingRowIndex = iTopRow '// set Top row.
        End With
codeorder 197 Nearly a Posting Virtuoso

Secondary issue, see if this helps.

For i As Integer = 0 To picBoxes.Length - 1
            With picBoxes(i)
                .pictureBox = CType(Me.Controls("PictureBox" & i + 1), PictureBox)
                .cover = My.Resources.ImperialLogo
                .pictureBox.Image = .cover
            End With
        Next

edit::
To make it easier on you the next time you need to add more than one control to an event, use something as this in Form_Load, instead of adding "pic1.click, pic2.click, picEtc.click".

For i As Integer = 1 To 36
            With CType(Me.Controls("PictureBox" & i), PictureBox)
                AddHandler .Click, AddressOf PictureBox1_Click
            End With
        Next

Hope this helps.:)

codeorder 197 Nearly a Posting Virtuoso

>>Not 100% sure what you mean by 2 ArrayLists.
Simple.

Public Class Form1
    Private arlFullNames, arlUserNames As New ArrayList

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        arlFullNames.Add("some full name")
        arlUserNames.Add("some full name's username")
        arlFullNames.Add("another full name")
        arlUserNames.Add("another full name's username")
        ComboBox1.Items.AddRange(arlFullNames.ToArray)
    End Sub

    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        MsgBox(arlUserNames(ComboBox1.SelectedIndex))
    End Sub
End Class
codeorder 197 Nearly a Posting Virtuoso

Not a database coder here, though could you not remove InvNomer, from sSql = "SELECT FullName ,InvNomer, BalanceDue From Invoice" and have it as sSql = "SELECT FullName , BalanceDue From Invoice" ?

codeorder 197 Nearly a Posting Virtuoso

>>I don't think your code (Above) will prevent this from happening, what's the best way to tackle that?
Entirely different question and I only replied to this thread for this question.

>>(PS. I'm a really new to coding,...
Would have never guessed.:D

As for the rest, glad I could help:); and If issue solved, then the thread should be as well.

Something else before I delete your project from my.p.c..
.I would place those images on frmHomePage in a Button's.BackgroundImage; just makes nice eye candy for the user when you hover over the btn.:)(view.attached)

codeorder 197 Nearly a Posting Virtuoso

Solving the problem caused another. Dam.n you God!:D

I personally have no idea how to save a 2D array to a file without having to loop thru all the arrays.
You should start a thread regarding this new issue and hopefully someone will be able to shine some light on this matter.

codeorder 197 Nearly a Posting Virtuoso

For my posted code, you do.
If you need to have it trigger when typing in TextBoxes, add the code to the TextChanged event of the TextBoxes.

Private Sub _TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged, TextBox2.TextChanged, TextBox3.TextChanged ', TextBoxETC.TextChanged
        '// validate TextBoxes code here.
    End Sub
codeorder 197 Nearly a Posting Virtuoso

keydown listview2 not go to row 21
but go to row 1, also keyUp not go to row 19 but go to row 1

any one can help, what to do

Is there still an issue?

codeorder 197 Nearly a Posting Virtuoso

See if this helps.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        For Each txt In New TextBox() {TextBox1, TextBox2, TextBox3} '// your TextBoxes.
            If txt.Text = "" Then Exit Sub '// skip remain code in Sub.
        Next
        Button2.Enabled = True '// enable if all TextBoxes have values.
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Button2.Enabled = False
    End Sub
Jx_Man commented: Great help for sure :) +14
codeorder 197 Nearly a Posting Virtuoso

See if this helps.

Private Sub _ListProduct_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles ListProduct.KeyDown
        With CType(sender, ListView)
            If Not .Items.Count = 0 Then
                .MultiSelect = False
                e.Handled = True '// block default handling.
                Select Case e.KeyCode
                    Case Keys.Up
                        .Items(0).Selected = True '// select first item.
                    Case Keys.Down
                        .Items(.Items.Count - 1).Selected = True '// select last item.
                End Select
                .SelectedItems(0).EnsureVisible() '// make sure that item is visible once selected.
                .HideSelection = False '// keep cute highlight on item.
            End If
        End With
    End Sub
codeorder 197 Nearly a Posting Virtuoso

"keydown" on which ListView?

codeorder 197 Nearly a Posting Virtuoso

Now which ListView isNot responding properly? ListGroup or ListProduct?

codeorder 197 Nearly a Posting Virtuoso

Not quite clear on your question.
Are you using the KeyUp/KeyDown Events for the ListView or are you referring to the Up/Down arrow keys on your keyboard?

codeorder 197 Nearly a Posting Virtuoso

I d/l'ed the project and got the "Black Ops" issue taken care of.
.The issues laid inside the Private Sub KillStreaks() (located it by commenting out lines for each called Sub) and I am not exactly certain as to why it froze, though I froze also when I took a look at the code inside that Sub.:D

I tried following along the same guidelines as the code posted w/in that Sub and hopefully this helps.
.Just replace your entire Private Sub KillStreaks() with the following code.

Private rnd As New Random '// DECLARED ONCE AND USES THE FUNCTION.

    Private Function getCoolRandomNumber(ByVal minCoolNumberValue As Integer, ByVal maxCoolNumberValue As Integer) As Integer
        rnd = New Random
        Return rnd.Next(minCoolNumberValue, maxCoolNumberValue)
    End Function
#Region "-----===-----===-----===-----===-----=== KILL STREAKS ===-----===-----===-----===-----===-----"
    Private Sub KillStreaks()
        '// send a random# to set the selected KillStreak.
        setKillStreaks(getCoolRandomNumber(1, 9), 1)
        setKillStreaks(getCoolRandomNumber(1, 9), 2)
        setKillStreaks(getCoolRandomNumber(1, 9), 3)
    End Sub

    Private Sub setKillStreaks(ByVal selRandomNumber As Integer, ByVal selKillStreak As Integer)
        Select Case selRandomNumber
            Case 1
                Select Case getCoolRandomNumber(1, 3)
                    Case 1
                        setKillStreakLabelText(selKillStreak, "SPY PLANE")
                    Case 2
                        setKillStreakLabelText(selKillStreak, "RC-XD")
                End Select
            Case 2
                Select Case getCoolRandomNumber(1, 3)
                    Case 1
                        setKillStreakLabelText(selKillStreak, "COUNTER-SPY PLANE")
                    Case 2
                        setKillStreakLabelText(selKillStreak, "SAM TURRET")
                End Select
            Case 3
                Select Case getCoolRandomNumber(1, 3)
                    Case 1
                        setKillStreakLabelText(selKillStreak, "CARE PACKAGE")
                    Case 2
                        setKillStreakLabelText(selKillStreak, "NAPALM STRIKE")
                End Select
            Case 4
                Select Case getCoolRandomNumber(1, 3)
                    Case 1
                        setKillStreakLabelText(selKillStreak, "SENTRY GUN")
                    Case 2
                        setKillStreakLabelText(selKillStreak, "MORTAR TEAM")
                End Select
            Case 5
                Select Case getCoolRandomNumber(1, 3)
                    Case 1
                        setKillStreakLabelText(selKillStreak, "ATTACK HELICOPTER")
                    Case 2
                        setKillStreakLabelText(selKillStreak, "VALKYRIE …
Tobyjug2222 commented: Great Feedback - Will work on the code now! :D +1
codeorder 197 Nearly a Posting Virtuoso
Public Class Form1
    Private x(6, 0) As String

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        reDimAndPreserveArray(1)
        MsgBox("x(" & x.GetUpperBound(0) & ", " & x.GetUpperBound(1) & ")") '// FOR.TESTING.
    End Sub

    Private Sub reDimAndPreserveArray(ByVal iNumberOfArraysToAdd As Integer)
        Static iCurrentNumberOfArrays As Integer = 0
        iCurrentNumberOfArrays += iNumberOfArraysToAdd
        ReDim Preserve x(6, iCurrentNumberOfArrays)
    End Sub
End Class

Click the btn a few times for testing and anytime you need to add more arrays, just use that Sub and specify the amount of arrays to add.
.btw: it will Preserve all the previous values for the array.
Hope this helps.:)

codeorder 197 Nearly a Posting Virtuoso

.Remove(.Navigate(urlMain & "solver.html")) from Form1_Load and add it to the top of your hat:D; that is if your hat is a Button, otherwise add it to a Button.:)

codeorder 197 Nearly a Posting Virtuoso

Had to modify quite a bit of code for you to post values to those <input/> TextBoxes since no IDs on them, though Nothing major.

Public Class Form1
    Private urlMain As String = "http://www.someurl.com/"

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        With WebBrowser1
            .ScriptErrorsSuppressed = True
            .Navigate(urlMain & "solver.html")
        End With
    End Sub

    Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
        With WebBrowser1
            txt.Text = .Url.AbsoluteUri
            Select Case .Url.AbsoluteUri
                Case urlMain & "solver.html"
                    With .Document '// since no IDs on the elements, locate all <input/> TextBoxes and set values as needed.
                        For Each elm As HtmlElement In .GetElementsByTagName("input")
                            With elm
                                If .Name = "lhs" Then .SetAttribute("value", TextBox1.Text)
                                If .Name = "rhs" Then .SetAttribute("value", TextBox2.Text)
                                If .Name = "variable" Then .SetAttribute("value", TextBox3.Text)
                            End With
                        Next
                        .Forms(1).InvokeMember("submit")
                    End With
                Case urlMain & "_answer.php"
                    .Navigate(urlMain & .Document.GetElementById("centerContentFrame").GetAttribute("src")) '// 2. extract url from iFrame and .Navigate to it.
            End Select
        End With
    End Sub
End Class

.btw, I also learned something from this; how to properly make use of the .GetElementsByTagName and I might just use that on my adventure to rob the internet of <input/> TextBoxes.:D

Hope this helps.:)

codeorder 197 Nearly a Posting Virtuoso

Try Private x(6, 5) As String and that should give you plenty more Indexes inside the bounds of the array.

codeorder 197 Nearly a Posting Virtuoso

>>i'm trying to do is define a two-dimentional array with the 2nd dimention as an undefined.
See if this helps regarding the 2D Array.

Public Class Form1
    Private x(6, 0) As String

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        x(0, 0) = "test"
        MsgBox(x(0, 0))
        x(1, 0) = "test again"
        MsgBox(x(1, 0))
    End Sub
End Class
codeorder 197 Nearly a Posting Virtuoso
Public Class Form1
    Private urlMain As String = "http://www.someurl.com/"
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        With WebBrowser1
            .ScriptErrorsSuppressed = True
            .Navigate(urlMain & "solver.html")
        End With
    End Sub

    Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
        With WebBrowser1
            txt.Text = .Url.AbsoluteUri
            If .Url.AbsoluteUri = urlMain & "_answer.php" Then '// 1. check if url is the page w/the answer on it.
                .Navigate(urlMain & .Document.GetElementById("centerContentFrame").GetAttribute("src")) '// 2. extract url from iFrame and .Navigate to it.
                '// 3. Thank "hericles" for pointing out the <iframe> and getting you a quicker solution from .Me.
            End If
        End With
    End Sub
End Class

:)

codeorder 197 Nearly a Posting Virtuoso

This has Nothing to do with your question, though I hope it helps.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        With TableLayoutPanel1
            .ColumnCount = 7 : .RowCount = 2 : .CellBorderStyle = TableLayoutPanelCellBorderStyle.Single
        End With
        addLabel("Monday", 1)
        addLabel("Tuesday", 2)
        addLabel("Wednesday", 3)
        addLabel("Thursday", 4)
        addLabel("Friday", 5)
        addLabel("Saturday", 6)
    End Sub
    Private Sub addLabel(ByVal dayOfWeek As String, ByVal columnIndex As Integer)
        TableLayoutPanel1.Controls.Add(New Label With {.Text = dayOfWeek, .Location = New Point(10, 20), .Size = New Size(100, 30)}, columnIndex, 0)
        'Controls.Add(TableLayoutPanel1)
    End Sub

Since I do not bother with db(database), I have no idea how to search it, though I do believe that you should advise which db you are using; if SQL, Access, etc..

codeorder 197 Nearly a Posting Virtuoso

I used a DGV with 3 columns for this, hope it helps.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        setHighLightsForConflicts(DataGridView1)
    End Sub
    Sub setHighLightsForConflicts(ByVal selDGV As DataGridView)
        With selDGV
            Dim s1, s2 As String, chrMain As Char : s1 = "" : s2 = s1 : chrMain = "|"
            For i As Integer = 0 To .RowCount - 1 '// loop thru all rows.
                With .Rows(i)
                    s1 = .Cells(0).Value & chrMain & .Cells(1).Value & chrMain & .Cells(2).Value '// store the row's value, easier to manage and compare to other rows.
                End With
                If Not i + 1 = .RowCount Then '// check if next item to check exists.
                    For x As Integer = i + 1 To .RowCount - 1 '// loop thru all items following the s1.Item.
                        With .Rows(x)
                            s2 = .Cells(0).Value & chrMain & .Cells(1).Value & chrMain & .Cells(2).Value '// set value.
                            If s1 = s2 Then '// compare and get results.
                                .DefaultCellStyle.BackColor = Color.Aquamarine
                                selDGV.Rows(i).DefaultCellStyle.BackColor = Color.Aquamarine
                            End If
                        End With
                    Next
                End If
            Next
        End With
    End Sub
amf101 commented: Your great!continue sharing your knowledge...and i will be back for more questions if you don't mind..hehe:D..thanks again! +1
codeorder 197 Nearly a Posting Virtuoso

See if this helps.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        searchDGV(TextBox1.Text)
    End Sub
    Sub searchDGV(ByVal selSearch As String)
        With DataGridView1
            Dim iTemp As Integer = 1
            If .AllowUserToAddRows Then iTemp = 2 '// check if extra row or not, at bottom of dgv.
            For i As Integer = 0 To .Rows.Count - iTemp '// loop thru all rows.
                For x As Integer = 0 To .Columns.Count - 1 '// loop thru all columns in a row.
                    If .Item(x, i).Value = selSearch Then '// locate your search.
                        .Rows(i).DefaultCellStyle.BackColor = Color.Lime
                    End If
                Next
            Next
        End With
    End Sub
codeorder 197 Nearly a Posting Virtuoso

Why Not load 2 ArrayLists, 1 with FullName and other w/the Username.
Load your ComboBox from FullName ArrayList and on ComboBox1_SelectedIndexChanged, display the result of the Username Arraylist.

codeorder 197 Nearly a Posting Virtuoso

See if this helps.

Public Class Form1
    Private myFolder As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) & "\"

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim xmlDoc As New Xml.XmlDocument, ndKeyList, ndStringList As Xml.XmlNodeList, iNodeIndex As Integer
        With xmlDoc '// load File and lists.
            .Load(myFolder & "test.xml") : ndKeyList = .GetElementsByTagName("key") : ndStringList = .GetElementsByTagName("string")
        End With
        For i As Integer = 0 To ndKeyList.Count - 1 '// loop thru key list.
            If ndKeyList(i).InnerText = "Serial Number" Then
                iNodeIndex = i '// set the Index where located.
                Exit For '// exit.loop since done.
            End If
        Next
        MsgBox(ndStringList(iNodeIndex).InnerText) '// display string at the same Index as the key.
    End Sub
End Class
codeorder 197 Nearly a Posting Virtuoso

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.

    End Sub
    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)
        Else
            MsgBox("index was outside the bounds of the cool array, since it is greater(in this case) than the TextBox.Lines", MsgBoxStyle.Critical)
        End If
    End Sub
codeorder 197 Nearly a Posting Virtuoso
codeorder 197 Nearly a Posting Virtuoso

>>(I'm posting from my phone)
No vb.net on phone?:'(
>>Had to shoo the cat off the keyboard.
I ate my cat and keyboard and I still beat you by a few seconds, HAH!!!

codeorder 197 Nearly a Posting Virtuoso

Reverend Jim, you must either be getting old or have a slow p.c., cause I just beat you by a few seconds.:D

codeorder 197 Nearly a Posting Virtuoso
With TextBox1
            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.
        End With
codeorder 197 Nearly a Posting Virtuoso

Do you just need to add values on separate lines, as: txtCustomerRecord.text = "info1" & vbNewLine & "info2" & vbNewLine & "info3" ?
.Or do you want to update a selected.line with a value?

codeorder 197 Nearly a Posting Virtuoso

See if this helps.

Public Class Form1
    Private arlTemp As New ArrayList

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        With ListBox1
            arlTemp.AddRange(.Items) '// store all lb.items.
            With .Items
                .Clear() '// clear lb.items for new input.
                For i As Integer = 0 To arlTemp.Count - 1 '// loop thru ArrayList.
                    If Not i + 1 = arlTemp.Count Then '// verify that i+1 will Not look for an item that isNot there.
                        For x As Integer = i + 1 To arlTemp.Count - 1 '// loop thru ArrayList again, starting at the next item.
                            If arlTemp(i) = arlTemp(x) Then '// locate similar item.
                                .Add(arlTemp(i)) '// add to lb(ListBox).
                                Exit For '// since done, exit the loop.
                            End If
                        Next
                    End If
                Next
            End With
        End With
    End Sub
End Class
codeorder 197 Nearly a Posting Virtuoso

See if this helps.
New.Project, 3.Buttons, 3.Panels(view attached image)

Public Class Form1
    Private pnTemp As Panel, iSelPanel As Integer

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        pnTemp = Panel1 '// pnTemp, just easier to work w/. :)
        If pnTemp.Height = 0 Then expandPanel(pnTemp) Else collapsePanel(pnTemp)
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        pnTemp = Panel2
        If pnTemp.Height = 0 Then expandPanel(pnTemp) Else collapsePanel(pnTemp)
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        pnTemp = Panel3
        If pnTemp.Height = 0 Then expandPanel(pnTemp) Else collapsePanel(pnTemp)
    End Sub

#Region "-----===-----===-----===-----===-----===  ===-----===-----===-----===-----===-----"
    Private Sub collapsePanel(ByVal selPanel As Panel)
        With selPanel.Name
            iSelPanel = CInt(.Substring(.Length - 1)) '// get # at end of Panel.Name.
        End With
        For i As Integer = 0 To selPanel.Height '// loop from 0 to panel.height
            selPanel.Height -= 1 '// ...and reduce height.
            For Each ctl In New Control() {Button1, Panel1, Button2, Panel2, Button3, Panel3} '// loop thru all btns and panels.
                If CInt(ctl.Name.Substring(ctl.Name.Length - 1)) > iSelPanel Then '// check if # at end of btn/panel is greater than the selectedPanel.
                    ctl.Top -= 1 '// move btn/panel up.
                End If
            Next
        Next
    End Sub
    Private Sub expandPanel(ByVal selPanel As Panel, Optional ByVal iPanelHeight As Integer = 125)
        With selPanel.Name
            iSelPanel = CInt(.Substring(.Length - 1))
        End With
        For i As Integer = 0 To iPanelHeight
            selPanel.Height += 1
            For Each ctl In New Control() {Button1, Panel1, Button2, Panel2, Button3, Panel3}
                If CInt(ctl.Name.Substring(ctl.Name.Length - 1)) …
codeorder 197 Nearly a Posting Virtuoso

.dgv(DataGridView) w/3 columns(to display row's values).

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        verifyRows()
    End Sub
    Sub verifyRows()
        With DataGridView1
            Dim iTemp As Integer = 0
            If .AllowUserToAddRows Then iTemp = 2 Else iTemp = 1 '// check if extra row or not, at bottom of dgv.
            For i As Integer = 0 To .Rows.Count - iTemp
                If .Item("Status", i).Value.ToString.ToLower = "ok" Then
                    MsgBox(.Item(0, i).Value & "/" & .Item(1, i).Value & "/" & .Item(2, i).Value)
                End If
            Next
        End With
    End Sub
codeorder 197 Nearly a Posting Virtuoso

See if this helps.

Private Sub ComboBox1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        For i As Integer = 1 To NamesArray.Length - 2
            With NamesArray(i)
                If .NamesNumber = ComboBox1.SelectedIndex + 1 Then
                    MsgBox(.FirstName & " " & .LastName & " #" & .NamesNumber)
                    Exit For
                End If
            End With
        Next
    End Sub