codeorder 197 Nearly a Posting Virtuoso

For this to work, you need to have ListView1.MultiSelect = False.

'// btnPrevious.
        If Not ListView1.SelectedItems.Count = 0 Then '// check if item is selected.
            With ListView1.SelectedItems(0)
                If Not .Index = 0 Then '// if not current index ='s the first item.
                    ListView1.Items(.Index - 1).Selected = True '// select previous item.
                    ListView1.Items(.Index - 1).EnsureVisible() '// make sure selected item is visible if ListView has vertical scrollbar.
                    navigaterecords(.Index - 1) '// get records for previous item.
                Else
                    MsgBox("Index at Start of records.")
                End If
            End With
        End If
'// btnNext.
        If Not ListView1.SelectedItems.Count = 0 Then '// check if item is selected.
            With ListView1.SelectedItems(0)
                If Not .Index = ListView1.Items.Count - 1 Then '// if not current index ='s the last item.
                    ListView1.Items(.Index + 1).Selected = True '// select next item.
                    ListView1.Items(.Index + 1).EnsureVisible() '// make sure selected item is visible if ListView has vertical scrollbar.
                    navigaterecords(.Index + 1) '// get records for next item.
                Else
                    MsgBox("Index at End of records.")
                End If
            End With
        End If

If .MultiSelect is a necessity, you can always toggle it to False just before running the code in each Button and set it back to True when done.

ListView1.MultiSelect = False
        '// code here for Previous/Next.
        ListView1.MultiSelect = True
codeorder 197 Nearly a Posting Virtuoso
Public Sub navigaterecords(ByVal lvItemIndex As Integer)
        With ListView1.Items(lvItemIndex)
            txtMed_ID.Text = .SubItems(0).Text
            txtMed_name.Text = .SubItems(1).Text
            txtfname.Text = .SubItems(2).Text
            txtMname.Text = .SubItems(3).Text
            txtDept_ID.Text = .SubItems(4).Text
            cboxgender.Text = .SubItems(5).Text
            txtDOB.Text = .SubItems(6).Text
            txtMed_Type.Text = .SubItems(7).Text
        End With
    End Sub
codeorder 197 Nearly a Posting Virtuoso

See if this helps.

Public Sub navigaterecords(ByVal lvItemIndex As Integer)
        With ListView1.Items(lvItemIndex)
            MsgBox(.SubItems(0).Text) '// for testing.
        End With
    End Sub
    '// First.
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        navigaterecords(0)
    End Sub
    '// Last.
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        navigaterecords(ListView1.Items.Count - 1)
    End Sub
codeorder 197 Nearly a Posting Virtuoso

See if this helps.
yearBox has years as: 2010,2009,2008,etc.
monthBox has months by name as: January, February, March, etc.

Private Sub myCoolYearsAndMonths_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) _
                                                         Handles yearBox.SelectedIndexChanged, monthBox.SelectedIndexChanged
        '// check if both boxes have values selected.
        If Not yearBox.SelectedIndex = -1 AndAlso Not monthBox.SelectedIndex = -1 Then
            dayBox.Items.Clear() '// clearDay box.
            '// loop from 1 to total days for that month during that year.
            For i As Integer = 1 To DateTime.DaysInMonth(CInt(yearBox.SelectedItem), monthBox.SelectedIndex + 1) '// +1 since index starts at 0, not 1
                dayBox.Items.Add(i) '// add day to dayBox.
            Next
        End If
        dayBox.SelectedIndex = dayBox.Items.Count - 1 '// view total days added.
    End Sub
Jake.20 commented: Yours is the simplest and understandable yet very useful, thank you sir. +1
codeorder 197 Nearly a Posting Virtuoso

Set .WindowState of a Form to Maximized/Minimized/Normal?

Me.WindowState = FormWindowState.Maximized
codeorder 197 Nearly a Posting Virtuoso

See if this helps.

'// paste in New Project and click to move Form.
'//-- Panel1 and PictureBox1 can be uncommented to use the same Events.
'//-- to use only a Panel, PictureBox, or any other control, just add the appropriate code for each event.
Public Class Form1

    Private allowCoolMove As Boolean = False
    Private myCoolPoint As New Point

    Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) _
                                         Handles Me.MouseDown ', Panel1.MouseDown, PictureBox1.MouseDown
        allowCoolMove = True '// enable move.
        myCoolPoint = New Point(Cursor.Position.X - Me.Location.X, Cursor.Position.Y - Me.Location.Y) '// get coordinates.
    End Sub

    Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) _
                                         Handles Me.MouseMove ', Panel1.MouseMove, PictureBox1.MouseMove
        If allowCoolMove = True Then
            Me.Location = New Point(Cursor.Position.X - myCoolPoint.X, Cursor.Position.Y - myCoolPoint.Y) '// set coordinates.
        End If
    End Sub

    Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) _
                                         Handles Me.MouseUp ', Panel1.MouseUp, PictureBox1.MouseUp
        allowCoolMove = False '// disable move.
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
    End Sub
End Class
codeorder 197 Nearly a Posting Virtuoso

Use the _TextChanged event of the RichTextBox.

Private Sub RichTextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RichTextBox1.TextChanged
        Label1.Text = (RichTextBox1.MaxLength - RichTextBox1.TextLength).ToString
    End Sub
codeorder 197 Nearly a Posting Virtuoso

An ArrayList is nothing more than a ListBox.
For example, adding an item to a ListBox, you use: ListBox1.Items.Add("test item") ... and adding an item to an ArrayList, you just use: myArrayList.add("test item") without the".Items".

See if this helps.
1 Button

Public Class Form1
    Private myFile As String = "C:\test.txt" '// your file.
    Private arlCoolArrayList As New ArrayList '// ArrayList used to load file lines/etc..
    Private rndArrayListItems As New Random '// for randomizing.

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If IO.File.Exists(myFile) Then arlCoolArrayList.AddRange(IO.File.ReadAllLines(myFile)) '// Load File Lines into Array List.
        '// add some items yourself if needed.
        arlCoolArrayList.Add("new item added to ArrayList")
        arlCoolArrayList.Add("add another, just because you can :D")
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        rndArrayListItems = New Random '// setting it as New Random usually returns a more random #.
        '// randomize from 0 to .Count, since using 0 to .Count-1 will not consider the last item.
        Dim iRandomNumber As Integer = rndArrayListItems.Next(0, arlCoolArrayList.Count)
        If Not arlCoolArrayList.Count = 0 Then ' check if items in ArrayList.
            MsgBox(arlCoolArrayList(iRandomNumber)) '// Display result.
        End If
        'arlCoolArrayList.Remove("new item added to ArrayList") '// remove item by String.
        '// Or...
        'arlCoolArrayList.RemoveAt(iRandomNumber) '// remove item by Index.
    End Sub
End Class
codeorder 197 Nearly a Posting Virtuoso

How are you loading employee names and their id numbers? From file? Database?

codeorder 197 Nearly a Posting Virtuoso

Check out this thread for info about a countdown timer.

codeorder 197 Nearly a Posting Virtuoso

>There is a way to generate a more random string, something new everytime it add more info?
You could load a file with thousands of random lines into an ArrayList and randomly select an item from the ArrayList to add to your file content and if needed, inject characters/.Substrings from that random item all throughout your file.

codeorder 197 Nearly a Posting Virtuoso

>There is a way to control it?
Why not? Save file every so often, check for file size and if not at your standard, add more content and save again.

Dim myCoolFileInfo As New IO.FileInfo("C:\test.txt") '// your file.
        MsgBox(CInt(myCoolFileInfo.Length).ToString("#,###,###,###,###") & " bytes") '// file size.
codeorder 197 Nearly a Posting Virtuoso

Does not adding the code from your thread for "Need help with background music" work if added to a Button.Click?

codeorder 197 Nearly a Posting Virtuoso

Have you attempted this with the code provided in your File wipe & drag-n-drop support thread?

By means of "a determined value", is that for file size or the content length in your file?

codeorder 197 Nearly a Posting Virtuoso

See if this helps.
1 Button

Imports System.Xml
Public Class Form1
    Private myXML_FileLocation As String = "C:\test.xml" '// .xml file and location.
    Private xmlDoc As New XmlDocument, xmlSelectedNode As XmlNode

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        xmlDoc.Load(myXML_FileLocation) 'Load the Xml file once if constantly in use.
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        getXMLnodeByID("2")
    End Sub
    Private Sub getXMLnodeByID(ByVal IDToUse As String)
        xmlSelectedNode = xmlDoc.SelectSingleNode("Subject/Items/Item[@id='" & IDToUse & "']")
        With xmlSelectedNode
            MsgBox(.SelectSingleNode("CustName").InnerText)
            MsgBox(.SelectSingleNode("Filename").InnerText)
            MsgBox(.SelectSingleNode("StartDate").InnerText)
            '// etc...
        End With
    End Sub
End Class

I noticed that your .xml file has <Item id="1"> which is all LowerCase and you were using ("/Subject/Items/Item[@ID='1']") .ToUpper, which will result in errors. At least it did on my part.

codeorder 197 Nearly a Posting Virtuoso

Could have been a similar code from an entirely different link.
Probably had a missing dot somewhere, causing the entire code to be useless.

Good to hear that you do some research before posting a thread and glad that I could provide some assistance, even if it is the 100th time doing so.:)

codeorder 197 Nearly a Posting Virtuoso

Check out this link.

codeorder 197 Nearly a Posting Virtuoso

Do I have to make another guess and assume that you only have 2 Buttons?

See if this helps.

Private Sub myCoolRadioButtons_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) _
                                                Handles RadioButton1.CheckedChanged, RadioButton2.CheckedChanged, RadioButton3.CheckedChanged '// etc..
        '// get # from RadioButton#.
        Dim x As String = CType(sender, RadioButton).Name.Substring(CType(sender, RadioButton).Name.IndexOf("n") + 1)
        '// enable/disable the Button that ends with the same # as your RadioButton.
        CType(Me.Controls("Button" & x), Button).Enabled = CType(sender, RadioButton).Checked
    End Sub

If that code is a little too complicated, you can use the following code sample.

Private Sub myCoolRadioButtons_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) _
                                                Handles RadioButton1.CheckedChanged, RadioButton2.CheckedChanged, RadioButton3.CheckedChanged '// etc..
        If RadioButton1.Checked Then Button1.Enabled = True Else Button1.Enabled = False
        If RadioButton2.Checked Then Button2.Enabled = True Else Button2.Enabled = False
        If RadioButton3.Checked Then Button3.Enabled = True Else Button3.Enabled = False
        '// etc.
    End Sub
codeorder 197 Nearly a Posting Virtuoso

See if this helps.
2 TextBoxes, 1 Button, 1 ListBox

Public Class Form1
    '// lowercase for testing against lowercase Text from the TextBox.
    Private myMonths() As String = {"january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"}

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        TextBox1.Text = "March" : TextBox2.Text = "10"
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        ListBox1.Items.Clear() '// clear for new input.
        Dim iMonthNumber As Integer = 0
        '// get the starting month by #.
        For i As Integer = 0 To myMonths.Length - 1 '// loop thru all arrays in the myMonths String Array.
            '// use .ToLower since user can type a "month" as "MonTh" and it will still get recognized.
            If TextBox1.Text.ToLower = myMonths(i) Then '// check if TextBox.Text equals the month in your myMonths String Array.
                iMonthNumber = i  '// add the month number that coresponds to the month in your myMonths String Array.
                Exit For '// Exit the loop since month was located.
            End If
        Next
        '// add months.
        For i As Integer = 1 To CInt(TextBox2.Text) '// loop from 1 to as many years.
            For x As Integer = 0 To myMonths.Length - 1 '// loop thru all months.
                '// if first item in ListBox, add the found month. vbProperCase to Capitalize first letter.
                ListBox1.Items.Add(StrConv(myMonths(iMonthNumber), vbProperCase))
                iMonthNumber += 1 '// increase to add the next month.
                If iMonthNumber = myMonths.Length Then iMonthNumber = 0 '// if monthNumber …
codeorder 197 Nearly a Posting Virtuoso

See if this helps.

'----------------------EXIT ROUTINE---------------------------------------------------------------------
    Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
        Me.Close() '// cause app to close.
    End Sub
    '----------------------END EXIT ROUTINE-----------------------------------------------------------------
    Private Sub frmRODSelectPage_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        '// when app. closes, it fires off this event just before it is done and will close.  no need to add Me.Close here.
        MsgBox("Are you sure you want to quit?", MsgBoxStyle.YesNo, "Exit Program?")
        System.IO.File.AppendAllText("E:\MILWAUKEE\FlexiCaptureImageFolder\log.txt", txtShowFileCopy.Text)
    End Sub
ayarton commented: Excellent response!!! +1
codeorder 197 Nearly a Posting Virtuoso

Since using a String and not a Number, use the "&" to "add to" the value of a String and not try and "add up" the value of a String by using "+".

if checkbox1.checked then textboxtext &= " checkbox1, "

Even though the "+" will probably work, have not tested, it is better for you and others in the long run when reviewing code. If "&", you will know that it "adds to" the value, and not "add up" the value.

Hope this helps.

jlego commented: thats code, gave me usefull advice + +2
codeorder 197 Nearly a Posting Virtuoso

1 RadioButton, 1 Button

Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
        If RadioButton1.Checked Then Button1.Enabled = True Else Button1.Enabled = False
    End Sub
codeorder 197 Nearly a Posting Virtuoso

See if this thread helps.
You will need 1 ListView and 1 Button in a New Project.
If you currently have a "C:\test.txt" File, delete it prior to running the code.

codeorder 197 Nearly a Posting Virtuoso

Seems like this new issue is not caused by the code I have provided, but by code in your Public Function findlrecords() As Integer .
You can add a Try/Catch statement in your Function for the time being and start a new thread for this new issue caused by your Function.

Glad I could help otherwise.

codeorder 197 Nearly a Posting Virtuoso

Change Private iTotal As Integer to:

Private iTotal As Double

Change If Not ctl.Text = "" Then iTotal += CInt(ctl.Text) to:

If Not ctl.Text = "" Then iTotal += CDbl(ctl.Text)
codeorder 197 Nearly a Posting Virtuoso

See if this helps.

Public Class Form1
    Private iTotal As Integer '// used to add up the Total of all Product TextBoxes.

    '// renamed from: TxtPPproduct1_TextChanged
    Private Sub myCoolTextBoxes_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) _
                                Handles TxtPPproduct1.TextChanged, TxtPPproduct2.TextChanged, TxtPPproduct3.TextChanged '// add remaining TextBoxes here.
        iTotal = 0 '// reset.
        For Each ctl As Control In Me.Controls '// loop thru all controls on Form.
            If TypeOf ctl Is TextBox And ctl.Name.StartsWith("TxtPPproduct") Then '// locate TextBoxes that .Name.StartsWith...
                If Not ctl.Text = "" Then iTotal += CInt(ctl.Text) '// if not a empty value in TextBox, add to Total.
            End If
        Next
        txtTOTAL.Text = CStr(iTotal) '// Display total in your TOTAL TextBox.
    End Sub
End Class
codeorder 197 Nearly a Posting Virtuoso

See if this helps.
2 Forms: Form1(1 Button, 1 PictureBox)

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If Not Form2.Visible Then : Form2.Show() : Exit Sub : End If
        PictureBox1.Image = getSnapshot(Form2)
    End Sub

    Private Function getSnapshot(ByVal snapshotForm As Form) As Bitmap
        With snapshotForm
            .FormBorderStyle = Windows.Forms.FormBorderStyle.None
            Dim bmp As New Bitmap(.Width + 15, .Height + 25, Imaging.PixelFormat.Format32bppArgb)
            Dim g As Graphics = Graphics.FromImage(bmp)
            g.CopyFromScreen(New Point(.Location.X, .Location.Y), New Point(0, 0), bmp.Size)
            .FormBorderStyle = Windows.Forms.FormBorderStyle.Sizable
            Return bmp
        End With
    End Function
End Class
Public Class Form2

    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.TransparencyKey = Me.BackColor : Me.TopMost = True : Me.MinimizeBox = False : Me.MaximizeBox = False
        Me.Text = "Snapshot View" : Me.Icon = SystemIcons.Information : Me.ShowInTaskbar = False
    End Sub
End Class

This will take a snapshot of Form2's Location and Size and will use Form2 as the snapshot window for your Screen Capture.

codeorder 197 Nearly a Posting Virtuoso

See if this helps.
1 ListView, 1 TextBox(for search value), 1 Button(to search)

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If Not ListView1.MultiSelect = False Then ListView1.MultiSelect = False '// disable MultiSelection of items.
        If TextBox1.Text = "" Then Exit Sub '// do not search on empty search value.
        For Each itm As ListViewItem In ListView1.Items '// loop thru all items.
            If itm.Text = TextBox1.Text Then '// check if itm.Text equals search value.
                itm.Selected = True '// select item.
                itm.EnsureVisible() '// if itm is not visible in ListView, make sure it is.
                ListView1.Select() '// select the ListView to show highlighted item.
                Exit For '// exit loop since itm found.
            End If
        Next
    End Sub

Or you can change the item's.BackColor if found.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If TextBox1.Text = "" Then Exit Sub '// do not search on empty search value.
        For Each itm As ListViewItem In ListView1.Items '// loop thru all items.
            If itm.Text = TextBox1.Text Then '// check if itm.Text equals search value.
                itm.BackColor = Color.GreenYellow   '// change item.BackColor if found.
                itm.EnsureVisible() '// if itm is not visible in ListView, make sure it is.
            Else
                itm.BackColor = ListView1.BackColor '// change all other items BackColor to ListView.BackColor.
            End If
        Next
    End Sub
codeorder 197 Nearly a Posting Virtuoso

See if this helps.
2 Forms (1 Button on Form1, 3 TextBoxes on Form2)

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If ListView1.SelectedItems.Count = 1 Then '// check if only 1 item is selected.
            With ListView1.SelectedItems(0) '// with Selected item.
                Form2.TextBox1.Text = .Text '// item text.
                Form2.TextBox2.Text = .SubItems(1).Text '// item column 2.Text
                Form2.TextBox3.Text = .SubItems(2).Text '// item column 3.Text
                Form2.ShowDialog()
            End With
        ElseIf ListView1.SelectedItems.Count = 0 Then '// if no item selected.
            MsgBox("Please select an item to edit.")
        ElseIf ListView1.SelectedItems.Count > 1 Then '// for "MultiSelect=True" ListViews.
            MsgBox("Please select only one item to edit.")
        End If
    End Sub
End Class
Public Class Form2
    '// save edited item back to ListView.
    Private Sub Form2_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        With Form1.ListView1.SelectedItems(0)
            .Text = TextBox1.Text : .SubItems(1).Text = TextBox2.Text : .SubItems(2).Text = TextBox3.Text
        End With
    End Sub
End Class
codeorder 197 Nearly a Posting Virtuoso

See if this helps.
1 ListBox, 1 Button

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        getMyCoolFiles("C:\", ListBox1)
        '// getMyCoolFiles(path of the folder you want to search, the ListBox to use for adding your found files to)
    End Sub

    Private Sub getMyCoolFiles(ByVal selectedDirectoryToSearch As String, ByVal ListBoxForFoundFiles As ListBox)
        ListBoxForFoundFiles.Items.Clear()
        Dim myCoolFolder As New IO.DirectoryInfo(selectedDirectoryToSearch)
        For Each foundDirectory In myCoolFolder.GetDirectories '// loop thru all top directories.
            Try
                '// search top directory and subfolders.
                For Each myFoundFile As IO.FileInfo In foundDirectory.GetFiles("*.*", IO.SearchOption.AllDirectories)
                    ListBoxForFoundFiles.Items.Add(myFoundFile.FullName) '// add File to ListBox.
                Next
            Catch ex As UnauthorizedAccessException
                'MsgBox(ex.Message) '// display Folders that have been Denied accessed to.
            End Try
        Next
        MsgBox("Total Files: " & CInt(ListBoxForFoundFiles.Items.Count).ToString("#,###,###")) '// display Total File Count.
    End Sub
End Class
horserider commented: Thank U +1
codeorder 197 Nearly a Posting Virtuoso

See if this helps.
2 Forms (1 TextBox and 1 Button on Form2)

Public Class Form1
    Public myCoolPassword As String = "cool" '// your preset Password.
    Public arlMyApplicationsList As New ArrayList '// add applications to this list.
    Private myRunningProcesses() As Process
    Private WithEvents myTimer As New Timer With {.Interval = 100, .Enabled = True}

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        '// add Applications to terminate if no Password.
        arlMyApplicationsList.Add("iexplore")
        arlMyApplicationsList.Add("notepad")
    End Sub

    Private Sub myTimer_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles myTimer.Tick
        For i As Integer = arlMyApplicationsList.Count - 1 To 0 Step -1 '// loop backwards when removing from lists, else it will crash your app.
            killProcess(CStr(arlMyApplicationsList(i)), Form2) '// send the application and your password Form.
        Next
    End Sub

    Private Sub killProcess(ByVal selectedApplication As String, ByVal myPasswordForm As Form)
        myRunningProcesses = Process.GetProcesses '// get current Processes.
        For Each selectedProcess As Process In myRunningProcesses '// loop thru all Processes.
            If selectedProcess.ProcessName.ToLower = selectedApplication Then '// check if Process is the Process to be found.
                selectedProcess.Kill() '// terminate the Process.
                If Not myPasswordForm.Visible = True Then '// check if your password Form is Not Visible.
                    myPasswordForm.Tag = selectedApplication '// set .Tag of password Form to the application that just got terminated.
                    myPasswordForm.ShowDialog() '// load Form.
                Else
                    myPasswordForm.Tag = selectedApplication '// change .Tag in case another application was attempted to load.
                    myPasswordForm.Activate() '// Activate to set Focus to.
                End If
                Exit Sub '// since done with current Process.
            End If
        Next
    End Sub …
codeorder 197 Nearly a Posting Virtuoso

See if this helps.

Public Class Form1
    Private inPar, outPar As Integer '// Declared once.

    Private Sub txtP1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) _
                                    Handles txtP1.TextChanged, txtP2.TextChanged, txtP3.TextChanged, _
                                    txtP18.TextChanged, txtP16.TextChanged, txtP17.TextChanged '// add your other txtP# TextBoxes here.
        UpdatePar()
        txtIn.Text = CStr(inPar) : txtOut.Text = CStr(outPar) : txtTotalPar.Text = CStr(inPar + outPar)
    End Sub

    Sub UpdatePar()
        inPar = 0 : outPar = 0  '// reset.
        For hole As Integer = 1 To 18
            For Each ctl As Control In Me.Controls '// Loop thru all Controls on Form.
                '// Locate TextBox AndAlso with the proper Name AndAlso make sure it is Numeric for adding under par scores.
                If TypeOf (ctl) Is TextBox AndAlso ctl.Name = "txtP" & hole.ToString AndAlso IsNumeric(ctl.Text) Then
                    If hole <= 9 Then If Not ctl.Text = "" Then outPar += CInt(ctl.Text) '// if TextBox has a value, add.
                    If hole >= 10 Then If Not ctl.Text = "" Then inPar += CInt(ctl.Text) '// if TextBox has a value, add.
                    Exit For '// Exit the loop since TextBox was located.
                End If
            Next
        Next
    End Sub
End Class
dooleyis commented: Fast response, useful code and well explained through notes. +0
codeorder 197 Nearly a Posting Virtuoso

See if this helps.

'// can also be located in the Control's Properties.
        ComboBox1.Sorted = True
        ListView1.Sorting = SortOrder.Ascending
        'ListView1.Sorting = SortOrder.Descending
        'ListView1.Sorting = SortOrder.None
codeorder 197 Nearly a Posting Virtuoso

Even w/the code I posted to "allow cross threading"?

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Control.CheckForIllegalCrossThreadCalls = False '// allow cross threading.
    End Sub
codeorder 197 Nearly a Posting Virtuoso

I'm not a console coder, but this should help.

Dim sInput As String = "250+1" '// value for testing.
        Dim iIndex As Integer = sInput.IndexOf("+") '// locate the "+".
        Dim iFirstNum As Integer = CInt(sInput.Substring(0, iIndex)) '// (startIndex, Length)
        Dim iSecondNum As Integer = CInt(sInput.Substring(iIndex + 1)) '// (startIndex and everything after)
        Dim sOutput As String = CStr(iFirstNum + iSecondNum)
        MsgBox("=> " & sOutput) '// Display result.
TechSupportGeek commented: Exactly what I was looking for! Problem solved! +2
codeorder 197 Nearly a Posting Virtuoso

See if this helps.
1 Button, 1 ListBox, 1 BackgroundWorker

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Control.CheckForIllegalCrossThreadCalls = False '// allow cross threading.
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        BackgroundWorker1.RunWorkerAsync() '// Start BackgroundWorker.
    End Sub

    Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
        ListBox1.Items.Clear() '// clear ListBox.
        Dim myCoolFolder As String = "C:\Program Files" '// your Folder.
        Try
            For Each myCoolFile As String In My.Computer.FileSystem.GetFiles _
                                             (myCoolFolder, FileIO.SearchOption.SearchAllSubDirectories, "*.*")
                ListBox1.Items.Add(myCoolFile) '// add File with FullPath.
            Next
        Catch ex As UnauthorizedAccessException
            MsgBox(ex.Message)
        End Try
        MsgBox("Total Files: " & CInt(ListBox1.Items.Count).ToString("#,###,###"))
    End Sub
End Class
kvprajapati commented: Helpful! +12
codeorder 197 Nearly a Posting Virtuoso
FileSize = CInt(GetSize(MyFile)).ToString("#,###,###,###") & " KB"
codeorder 197 Nearly a Posting Virtuoso

Since you have not mentioned which control to add the Files to, I will also use a ListBox.

Dim myCoolFolder As String = "C:\Program Files" '// your Folder.
        Try
            For Each myCoolFile As String In My.Computer.FileSystem.GetFiles _
                                            (myCoolFolder, FileIO.SearchOption.SearchAllSubDirectories, "*.*")
                'ListBox1.Items.Add(IO.Path.GetFileName(myCoolFile)) '// add only File Name with extension.
                ListBox1.Items.Add(myCoolFile) '// add File with FullPath.
            Next
        Catch ex As UnauthorizedAccessException
            MsgBox(ex.Message)
        End Try
        MsgBox("Total Files: " & CInt(ListBox1.Items.Count).ToString("#,###,###"))

To only search the Top Folder and not the SubFolders as well, change FileIO.SearchOption.SearchAllSubDirectories to: FileIO.SearchOption.SearchTopLevelOnly

codeorder 197 Nearly a Posting Virtuoso

This: If w.Length > 1 Then will check for words that have "only" more than one characters, and this: If w.Length >= 1 Then will check for words that have one character "and more".

It was an oversight on my part, did not thoroughly test it.

codeorder 197 Nearly a Posting Virtuoso

Not really interested, but others might find it useful. Do post your solution.

codeorder 197 Nearly a Posting Virtuoso

See if this helps about recognizing which TextBox is selected.

Public Class Form1
    Private mySelectedCoolTextBox As TextBox '// used to determine which TextBox has Focus.

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        mySelectedCoolTextBox.Focus() : SendKeys.Send("{BACKSPACE}") '// send the BackSpace key to your selected TextBox.
    End Sub

    Private Sub TextBox1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) _
                                    Handles TextBox1.GotFocus, TextBox2.GotFocus
        mySelectedCoolTextBox = CType(sender, TextBox) '// set your selected TextBox.
    End Sub
End Class
codeorder 197 Nearly a Posting Virtuoso

See if this helps.

'// Give focus to TextBox and Send the BackSpace key.
        TextBox1.Focus() : SendKeys.Send("{BACKSPACE}")

Or you can use this, which only removes the last char. unlike the SendKeys code.

With TextBox1
            If Not .Text = "" Then .Text = .Text.Substring(0, .TextLength - 1)
        End With
codeorder 197 Nearly a Posting Virtuoso

See if this helps for punctuation and one too many ProperCases:D.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim strWords() As String = TextBox1.Text.Split(" "c)
        TextBox2.Clear()
        For Each w As String In strWords
            If w.Length > 1 Then '// check if word length is greater than 1.
                If Char.IsLetterOrDigit(CChar(w.Substring(w.Length - 1, 1))) Then '// check if last char. is Letter or a Number.
                    If Not TextBox2.Text = "" Then : TextBox2.Text &= " " & StrConv(translateWord(w), vbProperCase)
                    Else : TextBox2.Text = StrConv(translateWord(w), vbProperCase)
                    End If
                Else '// if NOT last char. is Letter or a Number.
                    If Not TextBox2.Text = "" Then
                        '// send only the word without the last char. to the Function and add the last char. back to the word.
                        TextBox2.Text &= " " & StrConv(translateWord(w.Substring(0, w.Length - 1)) & w.Substring(w.Length - 1, 1), vbProperCase)
                    Else
                        TextBox2.Text = StrConv(translateWord(w.Substring(0, w.Length - 1)) & w.Substring(w.Length - 1, 1), vbProperCase)
                    End If
                End If
            End If
        Next
    End Sub
End Class

I ended up using "vbProperCase" for all Function Returns, but you only need to use it for words that first letter is capitalized.
.Give it a try and reply back if you succeed or need further help.

About not knowing how to use the "ProperCase", see if this helps.

Dim sTemp As String = "check me out, i'm going to be proper cased :D"
        MsgBox(StrConv(sTemp, vbProperCase))
codeorder 197 Nearly a Posting Virtuoso

See if this helps.
1 NotifyIcon, 1 ContextMenuStrip

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        NotifyIcon1.ContextMenuStrip = ContextMenuStrip1 '// attach ContextMenu to NotifyIcon.
    End Sub

    Private Sub NotifyIcon1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseClick
        If e.Button = MouseButtons.Right Then NotifyIcon1.ContextMenuStrip.Show() '// Show ContextMenu on Right Mouse click.
    End Sub
End Class
codeorder 197 Nearly a Posting Virtuoso

What about...

Return selectedWord.ToLower

Does not take care of the UpperCase letters, but it is a start for cleaning up.

As for the TextBox and the unknown case of the "empty space" at the beginning, check if TextBox has .Text, if not, do not add " ", else do.

For Each w As String In strWords '// loop thru all arrays.
            '// Since more than likely you will get more than one word in the TextBox, start with "If Not ='s "".
            If Not TextBox2.Text = "" Then TextBox2.Text &= " " & translateWord(w) Else TextBox2.Text = translateWord(w)
        Next

I'm quite busy for the rest of the day with beta testing software for a friend here at DaniWeb, but if you would like to check out another thread that has a String manipulation with keeping the end punctuation, check out this thread.
Let me know if that link helps, if not I'll see what I can do.

codeorder 197 Nearly a Posting Virtuoso

Glad I could help and thanks for the detailed information on how to get the consonant words sorted.

See if this helps.

Private iIndex As Integer = 0 '// used to determine where to start the .Substring if a word starts with a Consonant.

    Private Function translateWord(ByVal selectedWord As String) As String
        With selectedWord.ToLower '// use the "With" statement to shorten code.
            If .Contains("@") Then 'How do I check for other symbols?
                selectedWord = selectedWord
            ElseIf IsNumeric(selectedWord) Then  'Checks for numbers (working)
                selectedWord = selectedWord
            ElseIf .StartsWith("a") OrElse .StartsWith("e") OrElse .StartsWith("i") OrElse .StartsWith("o") OrElse .StartsWith("u") Then
                selectedWord &= "way"
            Else '// Next line checks for constants.
                iIndex = 0 '// reset.
                For Each c As Char In selectedWord '// loop thru all Characters one at a time.
                    '// check if char. is a vowel.
                    If c = "a" OrElse c = "e" OrElse c = "i" OrElse c = "o" OrElse c = "u" Then
                        '// get .Substring from location of vowel to end of string "&" add .Substring from start, with length of iIndex "&" add your "ay" to the end.
                        selectedWord = selectedWord.Substring(iIndex) & selectedWord.Substring(0, iIndex) & "ay"
                        Exit For '// Exit the loop once locating a vowel.
                    End If
                    iIndex += 1 '// increase +1 for next letter.
                Next
            End If
        End With
        Return selectedWord
    End Function

As for special char.s like "!@#$%", what do you plan to do with those?

If pig latin is for pigs and latin is for humans, then if …

codeorder 197 Nearly a Posting Virtuoso
MsgBox(Application.StartupPath & "\files\dlls\") '// use Application.StartupPath.
        MsgBox(IO.File.ReadAllText(TextBox1.Text & "test.txt")) '// for testing.

Should actually be:

MsgBox(Application.StartupPath & "\files\dlls\") '// use Application.StartupPath.
        MsgBox(IO.File.ReadAllText(Application.StartupPath & "\files\dlls\" & "test.txt")) '// for testing.

My apologies for the confusion, if any. I was using a TextBox1 for testing purposes.
The "test.txt" is a file located in the "dlls" folder.

codeorder 197 Nearly a Posting Virtuoso

See if this helps.

MsgBox(Application.StartupPath & "\files\dlls\") '// use Application.StartupPath.
        MsgBox(IO.File.ReadAllText(TextBox1.Text & "test.txt")) '// for testing.

When Debugging your project, it will use the bin\Debug folder. In this case, you will need to add your 2 folders to that directory.

After publishing your application and having it install, make sure that those 2 folders are in the same folder as your .exe.

codeorder 197 Nearly a Posting Virtuoso
Dim stroutput As Decimal

A Decimal is a Number, not Text. You need to declare it "As String" and include the value within the quotation marks.

Dim strOutput As String
        strOutput = "w"
        TextBox2.Text = strOutput

As for the rest, see if this helps.

Public Class Form1

    Private Function translateWord(ByVal selectedWord As String) As String
        '// use .ToLower in case there are LowerCase words that start with "a".
        If selectedWord.ToLower.StartsWith("a") Then selectedWord &= "-Way" '// use "&" when adding to a String.
        Return selectedWord
    End Function

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim strWords() As String = TextBox1.Text.Split(" "c) '// .Split .Text into arrays.
        TextBox2.Clear()  '// Clear your TextBox for new input.
        For Each w As String In strWords '// loop thru all arrays.
            TextBox2.Text &= " " & translateWord(w) '// add space and word to TextBox.
        Next
    End Sub
End Class
shawn130c commented: Descriptions on the code helped alot. +1
codeorder 197 Nearly a Posting Virtuoso

Probably not unless you program it to, but that is another question and not "code for autonumber on vb.net form".