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

Create a separate Sub just to send SMS and call it only when needed.

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If DateTime.Now = "time n date choosen by the customer" Then
            sendCOolSMS()
        End If
    End Sub
    Private Sub sendCOolSMS()
        MsgBox("send SMS code here")
    End Sub
codeorder 197 Nearly a Posting Virtuoso

Don't mind the feather in my hair and the courage in my sight, for I am the first and last of these footprints in the snow we thread. (.a youtube Mohican defined?.)

codeorder 197 Nearly a Posting Virtuoso

I shall someday thread as a feather thru the snows of winter, Not just thru the threads of this kingdom.

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

I managed to find a solution with the help of a vb.net friend from Brazil.

Private t1, t2 As Thread, t1S, t1E, t2S, t2E As Integer
    Sub searchFiles()
        lv.Items.Clear() : With prg : .Value = 0 : .Maximum = arFiles.Length : End With
        t1 = New Thread(AddressOf tr1) : t1S = 0 : t1E = 4000 : t1.Start()
        t2 = New Thread(AddressOf tr2) : t2S = 4001 : t2E = arFiles.Length - 1: t2.Start()
    End Sub
    Sub tr1()
        For i As Integer = t1S To t1E : scanFile(arFiles(i)) : If isSearchActive = False Then : Exit Sub : End If : Next
    End Sub
    Sub tr2()
        For i As Integer = t2S To t2E : scanFile(arFiles(i)) : If isSearchActive = False Then : Exit Sub : End If : Next
    End Sub
    Private Sub scanFile(ByVal selFile As String)
        '// scan file code here.
    End Sub

Above code is for only 2 threads, though I declared 9 threads(System.Threading.Thread) for my app, assigned each thread it's own start and end index(separate Integers) by splitting the entire folder file.count into as many threads as I needed for it to run and it blew me out of my chair when I pressed the start button.

Prior to using Threading, it would take around 30+/- seconds to scan my files, and after adding the threading to my.app, it scanned in 5+/- seconds, if not less.

codeorder 197 Nearly a Posting Virtuoso

As a Daniweb.com vb.net detective:D, I assigned myself to this case.

In order for me to fully understand the concept behind the strategy of creating a vb.net Connect 4 game, I had to start from the ground up and got some decent results.( view attached image ) Also attached, are the 2 images needed for the following beta.code to make this project work.
New.Project, 1.Button, 1.Panel

Public Class Form1

#Region "-----===-----===-----===-----===-----=== DECLARATIONS ===-----===-----===-----===-----===-----"
    Private myFolder As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) & "\TEST\" '// folder for the 2 images.
    Private imgRed As Image = Image.FromFile(myFolder & "red.png"), imgYellow As Image = Image.FromFile(myFolder & "yellow.png") '// the 2 images.

    Private iPlayerInTurn As Integer = 1 '// keeps track of which player.
    '// array for PictureBoxes, array for Horizontal score, array for Vertical score. :scores are added to each score array from each PictureBox's.Tag.
    Private arPB(6, 9) As PictureBox, arHorzScore(6) As String, arVertScore(9) As String
    Private s1Winner As String = "1111", s2Winner As String = "2222" '// score patterns to look for and compare against current score values.
#End Region

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        createDynamicPictureBoxes()
        '//--- FOR.BETA TESTING.
        With Button1 : .Text = ".new" : .Cursor = Cursors.Hand : End With
        With Me : .Text = "Connect 4 - vb.net"
            .Left = .Left - 125 : .Top = .Top - 75
        End With
        '---\\
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click …
codeorder 197 Nearly a Posting Virtuoso

See if this helps, since it loads the xml.nodes into a list and loops thru them.

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

Putting others first only leaves .Me in second place and being in first place is something that I do Not live for.

codeorder 197 Nearly a Posting Virtuoso

See if this helps.

Imports System.IO
Public Class Form1
    Private myCoolFile As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) & "\test.txt" '// your file.

    Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        File.WriteAllText(myCoolFile, saveCoolControls("TextBox", 3) & vbNewLine & saveCoolControls("MaskedTextBox", 3)) '// overwrite/create file.
    End Sub
    Private Function saveCoolControls(ByVal selCoolControlType As String, ByVal numberOfCoolControls As Integer) As String
        Dim sTemp As String = ""
        For i As Integer = 1 To numberOfCoolControls '// loop thru controls on Form.
            With CType(Me.Controls(selCoolControlType & i), Control) '// locate specified control.
                If Not sTemp = "" Then sTemp &= vbNewLine '// saves lines and adds line.breaks.
                sTemp &= .Name & ":" & .Text '// add .Name and .Text to save and load from, separated by ":".
            End With
        Next
        Return sTemp '// return the data for saving.
    End Function
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If IO.File.Exists(myCoolFile) Then '// check if file exists.
            For Each itm As String In File.ReadAllLines(myCoolFile) '// load file content in Array.
                If Not itm = "" Then '// verify that line has content.
                    With itm '// locate ctl by name and add value to it.
                        CType(Me.Controls(.Substring(0, .IndexOf(":"))), Control).Text = .Substring(.IndexOf(":") + 1)
                    End With
                End If
            Next
        End If
    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

Having a bit of an issue with my file.scanner and that issue is that I cannot figure out how to run multi.threading when searching the files within a folder(8,000+ files).

Imports System.IO
Module x
    Function xGetFolderFilesCount(ByVal selFolder As String) As Integer
        If Directory.Exists(selFolder) Then Return Directory.GetFiles(selFolder).Length Else Return 0
    End Function
    Function xLoadFolderFiles(ByVal selFolder As String, Optional ByVal searchPattern As String = "*", _
                              Optional ByVal searchOption As SearchOption = SearchOption.TopDirectoryOnly) As Array
        If Directory.Exists(selFolder) Then Return Directory.GetFiles(selFolder, searchPattern, searchOption) Else Return Nothing
    End Function
End Module

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

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If Not xGetFolderFilesCount(myFolder) = 0 Then
            For Each itm As String In xLoadFolderFiles(myFolder)
                '// Run multi.threading here.
                'MsgBox(itm)
            Next
        End If
    End Sub
End Class

I tried System.Threading.Thread and using the following...

Private Sub scanFile()
        If Me.InvokeRequired Then
            Me.Invoke(New MethodInvoker(AddressOf scanFile))
        Else
            '// code here to scan file.
        End If
    End Sub

...which returned the search.results at the same rate as it did without using the System.Threading.Thread .

Any and all input on this issue is welcomed.
Thanks in advance,
.Me

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

Only way to become the best is to constantly pursue it.

codeorder 197 Nearly a Posting Virtuoso

Get Visual Basic 2010 Express and thank me later for it.:)

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

To believe is not to believe at all, if you have no faith.

codeorder 197 Nearly a Posting Virtuoso

Glad I could help.:)

codeorder 197 Nearly a Posting Virtuoso

See if this.post helps for other options.

I personally prefer files to save/load to/from and in your case, I would save each ctl's.Text as a single line, load those lines into an Array and set values to each ctl.Text from there.

codeorder 197 Nearly a Posting Virtuoso

>>I finally gave up and used a 3rd party program which worked like a charm.
Care to share a charmed.link/name w/the rest of us?

codeorder 197 Nearly a Posting Virtuoso

:)
(btw: that smiley isNot for reply to your post, though glad I could help; that smiley is to look down on the "Marked as Solved", for when it finally gets there. Guess I'm just one step ahead, as I seem to be.

codeorder 197 Nearly a Posting Virtuoso

I ate myself, Not the homework.:D
(says a dog to his kid.master, when asked "Why did you not eat my homework?")

codeorder 197 Nearly a Posting Virtuoso

When there is Nothing to understand, Then Nothing does Not exist.

codeorder 197 Nearly a Posting Virtuoso

For this typeOf(issue), use a Boolean; reason: Booleans only toggle between a True/False and Nothing Else.

Public Class Form1
    Private myFolder As String = "\My Documents\"
    Private myFile As String = myFolder & "123.txt" '// file to check if .Exists.
    Private WithEvents tmrFileExists As New Timer With {.Interval = 1000, .Enabled = True} '// dynamic Timer.
    Private bIsButtonClickable As Boolean = True '// Boolean to determine if Button is clickable.

    Private Sub tmrFileExists_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles tmrFileExists.Tick
        If mySelectedCoolFileExists() = True Then
            _Button1_Click(sender, New System.EventArgs())
        Else
            bIsButtonClickable = True
        End If
    End Sub

    Private Sub _Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If bIsButtonClickable = True Then
            If mySelectedCoolFileExists() = True Then
                bIsButtonClickable = False
                MessageBox.Show("file exits")
            End If
        End If
    End Sub
    Private Function mySelectedCoolFileExists() As Boolean
        If System.IO.File.Exists(myFile) = True Then
            Return True
        Else
            Return False
        End If
    End Function
End Class

It checks twice for the File, though if it were not morning here, I would have had it check for the file only once, by using another Boolean of course.:)

Other than that, glad I could be your wing.man for the time being and glad I could help.:)

cheekangteh commented: solution +1
codeorder 197 Nearly a Posting Virtuoso

To become Nothing, you have to have everything.

codeorder 197 Nearly a Posting Virtuoso

Check out this code.snippet, might help.