codeorder 197 Nearly a Posting Virtuoso

The only reasonable solution that is probably the best solution to use, is not to add a CheckBox control on top of the ListView, but to add images in the ColumnHeader of the ListView.

For this next piece of code to work properly, you will need to have 2 images of the CheckBox not Checked and Checked, and specify their location if different from "C:\".
1 ListView, 2 images(attached)

Public Class Form1

    Private Sub designListView()
        With ListView1
            .Size = New Size(125, 125)
            .Columns.Add("", 25) '// No Titled Column and sized for image of CheckBoxes.
            .Columns.Add("Column 1", 100)
            .Columns.Add("Column 2", 100, HorizontalAlignment.Center)
            .View = View.Details : .CheckBoxes = True : .FullRowSelect = True
            '// When adding Items, do not add it as the Item's.Text, Start adding at the first .SubItem of the Item.
            Dim x As String = ",item1 subitem1,subitem2" : Dim lvItm As New ListViewItem(x.Split(","c)) : .Items.Add(lvItm)
            x = ",item2 subitem1,subitem2" : lvItm = New ListViewItem(x.Split(","c)) : .Items.Add(lvItm)
            x = ",item3 subitem1,subitem2" : lvItm = New ListViewItem(x.Split(","c)) : .Items.Add(lvItm)
        End With
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        designListView() '// For TESTING.
        Dim imgList As New ImageList With {.ImageSize = New Size(13, 13), .ColorDepth = ColorDepth.Depth32Bit} '// New ImageList.
        Dim imgCheckedNot As Image = Image.FromFile("C:\checkedNot.png") '// image for Not Checked.
        Dim imgChecked As Image = Image.FromFile("C:\checked.png") '// image for Checked.
        '// Add 2 images to the ImageList.
        imgList.Images.Add(imgCheckedNot) '// Add Not Checked Image first.
        imgList.Images.Add(imgChecked) '// Add Checked Image.
        ListView1.SmallImageList = …
codeorder 197 Nearly a Posting Virtuoso

Option 1. Add a blank titled column just for the CheckBoxes and start adding your ListView Items from the first SubItem and not as the Item.Text. (image 1)

With ListView1
            .Columns.Add("", 23) '// No Titled Column and sized for CheckBoxes.
            .Columns.Add("Column 1", 100)
            .View = View.Details : .CheckBoxes = True : .FullRowSelect = True
            Dim lvItm As New ListViewItem(",subitem".Split(","c)) : .Items.Add(lvItm)
            lvItm = New ListViewItem(",subitem".Split(","c)) : .Items.Add(lvItm)
            lvItm = New ListViewItem(",subitem".Split(","c)) : .Items.Add(lvItm)
        End With

Option 2. If your first Column is titled "Column 1", add a few empty spaces just prior to the title for accommodating the CheckBox.(image 2)

With ListView1
            .Columns.Add("     Column 1", 100)
            .Columns.Add("Column 2", 100)
            .View = View.Details : .CheckBoxes = True : .FullRowSelect = True
            Dim lvItm As New ListViewItem("item,subitem".Split(","c)) : .Items.Add(lvItm)
            lvItm = New ListViewItem("item 2,subitem".Split(","c)) : .Items.Add(lvItm)
            lvItm = New ListViewItem("item 3,subitem".Split(","c)) : .Items.Add(lvItm)
        End With
jlego commented: + +2
codeorder 197 Nearly a Posting Virtuoso

I only helped because I thought this was to block ADs mostly for personal use, not to get rich doing it. I will not support such. How's that for "legitimate".

jlego commented: + +0
codeorder 197 Nearly a Posting Virtuoso

I do not believe that there is such a Property, unless you create one.:)

See if this helps otherwise.
3 Panels (including Labels and TextBoxes as your attached images)

Public Class Form1
    Private iWidth As Integer = 0 '// used to resize.

    Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
        iWidth = CInt((Me.ClientRectangle.Width - 20) / 3) '// change the "-20" to work as needed for your project.
        Panel1.Width = iWidth : Panel2.Width = iWidth : Panel3.Width = iWidth '// resize Panels.
        Panel2.Left = Panel1.Left + Panel1.Width + 5 : Panel3.Left = Panel2.Left + Panel2.Width + 5 '// set Panels New Locations.
        resizeTextBoxes(Panel1) : resizeTextBoxes(Panel2) : resizeTextBoxes(Panel3) '// resize TextBoxes in Panels.
    End Sub

    Private Sub resizeTextBoxes(ByVal selectedPanel As Panel)
        For Each ctl As Control In selectedPanel.Controls
            If TypeOf ctl Is TextBox Then ctl.Width = (selectedPanel.Width - ctl.Left) - 5 '//  "-5" accumulates the space of TextBox and end of Panel.
        Next
    End Sub
End Class
codeorder 197 Nearly a Posting Virtuoso

Possible solution located in similar thread.

codeorder 197 Nearly a Posting Virtuoso

thank u for that...
still it is not working properly...
if i check the checkbox a msgbox will pop up.. "item NOT checked"...

Try my code in a New Project and let me know if you get the same results.

codeorder 197 Nearly a Posting Virtuoso

See if this helps.

For Each itm As ListViewItem In ListView1.Items
            If itm.Checked Then
                MsgBox("item checked: " & itm.Text)
            Else
                MsgBox("item NOT checked: " & itm.Text)
            End If
        Next
bLuEmEzzy commented: Great... yoU are Great... +1
codeorder 197 Nearly a Posting Virtuoso

For alphanumeric ID generator, see if this helps.

Dim myChars As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" '// Characters to use for ID.
        Dim myID As String = Nothing '// used to add random char. until the preset ID length.
        Dim idLength As Integer = 10 '// allow a 10 char. Alphanumeric ID.
        Dim rnd As New Random '// for randomizing char.s.
        For i As Integer = 1 To idLength '// each loop adds 1 random char. 
            myID &= myChars(rnd.Next(0, myChars.Length)) '// add random char. to String. ex: myChars(2) ='s "C".
        Next
        MsgBox(myID) '// display result.

For a alphanumeric ID that only generates a numeric increase in ID numbers, see if this helps.

Private myID As String = "CUST00025" '// ID loaded from/saved to...
    Private iTemp As Integer = 0
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        iTemp = CInt(myID.Substring(4, myID.Length - 4)) '// get only the #'s from String and Convert them to Integer.
        iTemp += 1 '// increase the ID # + 1.
        myID = myID.Substring(0, 4) & iTemp.ToString("00000") '// set the ID back with String and #'s formatted to 5 digit #.
        MsgBox(myID) '// display result.
    End Sub
bettybarnes commented: thank you :) +2
codeorder 197 Nearly a Posting Virtuoso

If you just want to Delete a File from the system, use:

IO.File.Delete("full path of file to delete here")

Otherwise, let me know if this helps.
1 Button, 1 ProgressBar(useful when shredding the file over 10,000 times :D)

Public Class Form1
    Private iNumberOfTimesToShred As Integer = 10 '// Times to load/manipulate/save the File.
    Private iNumberOfCharactersToInjectPerShred As Integer = 25 '// Characters in sCharactersToInjectIntoFile. 
    '// Loaded a image in Notepad++ and found tons of cool char. to inject into the File Randomly.
    Private sCharactersToInjectIntoFile As String = "›ÙÅ×¾e…€è½Ø`WØÙÛlÕÎÓ¶mßSöÌ‹ïº;ϼç;¶mßSöÌ‹ïº;ϼç;éHO>òßp¦B‚ƺŒßf=¦ì°¡óÓlÜòL›™tØ–l;a«wŸù1òag½1â;éHO>Ó|¤Õì0ÙšöÓqÖ#W[W­’î;uKŽ1š•Ý3Z±5²èqÃnͦíÓ0íè%;xê%;õ¯õëï}lKVm´µ[Ò,mÿIË:ù¬í>¬UÕ©:½ã¾¬Ž—fw}ýnÓe,&¹xDEb{XÑê=­tmš)ý®ƒúå=¤!î(Ê–}òeè×}Ý‘7¬v÷ÉöPöíïÿ«ýâ÷±¿üãú÷7ŸµÖî/RËÊk¨SI‹"
    Private sMain As String = Nothing '// String to load File in and manipulate the file content.
    Private sTemp, sTemp2 As String '// Temp Strings used as needed.
    Private rnd As New Random '// Used to Randomize which characters to replace and which characters to inject.

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim ofd As New OpenFileDialog
        If ofd.ShowDialog = DialogResult.OK Then
            sMain = IO.File.ReadAllText(ofd.FileName, System.Text.Encoding.Default) '// Load File as String.
            ProgressBar1.Maximum = iNumberOfTimesToShred : ProgressBar1.Value = 0 '// Set/Reset Properties of Progressbar.
            Do Until ProgressBar1.Value = iNumberOfTimesToShred '// Loop until the ProgressBar.Value is the Total of times to Shred.
                For i As Integer = 1 To iNumberOfCharactersToInjectPerShred '// inject random char. in file.
                    sTemp = sCharactersToInjectIntoFile.Substring(rnd.Next(0, sCharactersToInjectIntoFile.Length), 1) '// get random char.
                    rnd = New Random : sMain = sMain.Insert(rnd.Next(0, sMain.Length), sTemp) '// insert at random into File.
                Next
                sTemp = sMain.Substring(rnd.Next(0, sMain.Length), 1) '// select a random char.
                rnd = New Random : …
mrbungle commented: Great insight! +1
codeorder 197 Nearly a Posting Virtuoso

See if this helps.
2 Buttons (Button1, Button2), 1 ProgressBar

Public Class Form1
    '// Url for Paint.NET Download. ( http://www.getpaint.net/ )
    Private myURL As String = "http://www.dotpdn.com/files/Paint.NET.3.5.6.Install.zip"
    '// File Location Saved to Desktop with the Original File Name and Extension.
    Private myFile As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) & myURL.Substring(myURL.LastIndexOf("/"))
    '// WebClient for Downloading File.
    Private WithEvents myWebClient As New Net.WebClient()

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Button1.Text = "Download" : Button2.Text = "Cancel"
    End Sub

    '// Download.
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        myWebClient = New Net.WebClient
        ProgressBar1.Value = 0
        Me.Text = "Downloading..."
        myWebClient.DownloadFileAsync(New Uri(myURL), myFile)
        Button1.Enabled = False
    End Sub
    '// Cancel Download.
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        myWebClient.CancelAsync()
        Application.DoEvents()
        Button1.Enabled = True
        Me.Text = "Download Canceled"
    End Sub

    Private Sub myWebClient_DownloadFileCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.AsyncCompletedEventArgs) Handles myWebClient.DownloadFileCompleted
        If ProgressBar1.Value = ProgressBar1.Maximum Then
            MsgBox("Download Completed", MsgBoxStyle.Information)
            Button1.Enabled = True
        Else
            IO.File.Delete(myFile) '// Delete File if Download is NOT Complete.
        End If
    End Sub
    '// Download Progress.
    Public Sub myWebClient_DownloadProgressChanged(ByVal sender As Object, ByVal e As System.Net.DownloadProgressChangedEventArgs) Handles myWebClient.DownloadProgressChanged
        Try
            Dim dDownloadProgress As Decimal = CStr(e.BytesReceived / e.TotalBytesToReceive * 100)
            ProgressBar1.Value = CInt(dDownloadProgress)
            '// Display Download Status.
            Dim dDownloadedMB As Decimal = Format((e.BytesReceived / 1024) / 1024, "###,###,##0.00")
            Dim dTotalToDownloadMB As Decimal = Format((e.TotalBytesToReceive / 1024) / 1024, "###,###,##0.00")
            Me.Text = "Downloaded: " & dDownloadedMB & "MB out of " & dTotalToDownloadMB & "MB …
Unhnd_Exception commented: Very Nice +1
mrbungle commented: Good job bro! Well done! +1
codeorder 197 Nearly a Posting Virtuoso

See if this helps.

Public Class Form1
    '// Prices for the CheckBoxes as Decimal Arrays.
    Private myCoolCheckBoxPrices() As Decimal = {2, 3.5, 4.35, 1.75, 5, 9.99, 0.75}
    '// To get the value of the 3rd Array, since Index based, you would use: myCoolCheckBoxPrices(2)

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim myTotalPrice As Decimal = 0 '// Reset Total Price.
        '// If CheckBox is Checked, add the Decimal Array to myTotalPrice.
        If CheckBox1.Checked Then myTotalPrice += myCoolCheckBoxPrices(0)
        If CheckBox2.Checked Then myTotalPrice += myCoolCheckBoxPrices(1)
        If CheckBox3.Checked Then myTotalPrice += myCoolCheckBoxPrices(2)
        If CheckBox4.Checked Then myTotalPrice += myCoolCheckBoxPrices(3)
        If CheckBox5.Checked Then myTotalPrice += myCoolCheckBoxPrices(4)
        If CheckBox6.Checked Then myTotalPrice += myCoolCheckBoxPrices(5)
        If CheckBox7.Checked Then myTotalPrice += myCoolCheckBoxPrices(6)
        MsgBox(myTotalPrice.ToString("c")) '// Display result.
    End Sub
End Class
codeorder 197 Nearly a Posting Virtuoso

See if this helps.

Public Class Form1
    Private myCoolFile As String = "C:\test.txt" '// your File. Make sure there is NO Previous "C:\test.txt" File.
    Private arlUrlList As New ArrayList '// ArrayList to add your Urls.

    Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        '// Add some Urls to the ArrayList for testing.
        arlUrlList.Add("daniweb.com/forums/thread344440.html")
        arlUrlList.Add("daniweb.com/forums/forum58.html")
        arlUrlList.Add("google.com/firefox?client=firefox-a&rls=org.mozilla:en-US:official")

        Dim iSid As Integer = 17000001 '// your sid #.
        Dim myWriter As New IO.StreamWriter(myCoolFile) '// Open a StreamWriter to Save Urls to File.
        For Each myItem As String In arlUrlList '// Loop thru all items in Urls List.
            '// write to File( .Substring from 0 to the First Index of "/" ; .Substring from the First Index of "/" to end of String ; and your sid # )
            myWriter.WriteLine(myItem.Substring(0, myItem.IndexOf("/")) & ";" & myItem.Substring(myItem.IndexOf("/")) & ";sid:" & iSid)
            iSid += 1 '// Increment the sid # + 1.
        Next
        myWriter.Close()
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If IO.File.Exists(myCoolFile) Then
            Dim arMyFileLines() As String = IO.File.ReadAllLines(myCoolFile) '// Load each line as a String Array.
            Dim arTemp() As String '// .Split each Line.
            For Each myLine As String In arMyFileLines '// Lopp thru all Lines.
                arTemp = myLine.Split(";"c) '// .Split Line by the ";" char.
                MsgBox(arTemp(0) & vbNewLine & arTemp(1) & vbNewLine & arTemp(2)) '// Display result.
            Next
        Else '// For Testing Purposes: Restarts to Save the File if it does not exist.
            Application.Restart()
        End If
    End Sub
End Class
dipopo commented: Codeorder is a fantastic helper. I am highly appreciative of his work! +0
codeorder 197 Nearly a Posting Virtuoso

Since vbScript is quite similar to vb.net, I decide to give it a try.
My Notepad++ is nothing like the vb.net code editor :D, but it does quite nicely.

See if this helps as my first attempt at VbScript.

Select Case LCase(Answer)'// to Lower Case, not to be Case Sensitive.
	Case "rock"
		If CardImage = "Paper" Then MsgBox "Paper Covers Rock: Computer Wins!"
		If CardImage = "Scissors" Then MsgBox "Rock Breaks Scissors: You Win!"
		If CardImage = "Rock" Then MsgBox "TIE!" 
	Case "paper" 
		If CardImage = "Scissors" Then MsgBox "Scissors Cuts Paper: Computer Wins!"
		If CardImage = "Rock" Then MsgBox "Paper Covers Rock: You Win!"
		If CardImage = "Paper" Then MsgBox "TIE!"
	Case "scissors"
		If CardImage = "Rock" Then MsgBox "Rock Breaks Scissors: Computer Wins!"
		If CardImage = "Paper" Then MsgBox "Scissors Cuts Paper: You Win!"
		If CardImage = "Scissor" Then MsgBox "TIE!" 
End Select

Btw, interesting topic.

AndreRet commented: Not bad for a .netter :) +6
codeorder 197 Nearly a Posting Virtuoso

See if this helps.

If TextBox1.Text = Nothing OrElse TextBox2.Text = Nothing OrElse TextBox3.Text = Nothing Then
            MsgBox("TextBoxes CANNOT be Empty.", MsgBoxStyle.Critical)
            Exit Sub '// Skip the remaning code in the Sub.
        End If
        '// Save code here.
rEhSi_123 commented: Exactly what I was looking for! Excellent +3
codeorder 197 Nearly a Posting Virtuoso

Replace the "MsgBox(selFile) '// Show FullPath of File.)" with this.

Export = Path.GetFileName(selFile) 'sends only the filename and extension to the variable export
        FileCopy(selFile, "c:\flexihotfolder\" & Export)
ayarton commented: AWESOME! +1
codeorder 197 Nearly a Posting Virtuoso

See if this helps.

OpenFD.Multiselect = True '// Allow Multiple File Selections.
        If OpenFD.ShowDialog = DialogResult.OK Then
            For Each selFile As String In OpenFD.FileNames
                MsgBox(selFile) '// Show FullPath of File.
            Next
        End If
codeorder 197 Nearly a Posting Virtuoso

yeH syug!

woH nac I trevni ro( esrever, revetahw) a gnirts, tub gnisrever hcae drow?

ekiL:

sihT si a gnirts.
tuptuO:

This is a string.
dna ton:

string. a is This
oslA, woh nac I od ti ot a eritne elif?

sknahT ni ecnavda!

teL em wonk fi siht spleh.:D

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim myFile As String = "C:\test.txt" '// your File.
        If IO.File.Exists(myFile) Then '// Check if File.Exists.
            MsgBox(reverseFileContent(myFile)) '// Display Result.
            IO.File.WriteAllText(myFile, reverseFileContent(myFile)) '// Save Reversed File.
        Else : MsgBox("File Does Not Exist.")
        End If
    End Sub

    Function reverseFileContent(ByVal mySelectedFile As String) As String
        Dim arFileLines() As String = IO.File.ReadAllLines(mySelectedFile) '// Load each line as a String Array.
        Dim arWords() As String = Nothing '// used to Split. each line into Words.
        Dim sChar As String = Nothing '// used to get/set last char of word if not a Letter.
        Dim sTemp As String = Nothing '// used to save Reversed Lines.
        For iFileLineNumber As Integer = 0 To arFileLines.Length - 1 '// Loop thru all Lines.
            If arFileLines(iFileLineNumber).Contains(" "c) Then '// Check if Current Line Contains. a "space".
                arWords = arFileLines(iFileLineNumber).Split(" "c) '// Split. Line into Words by "space".
                For iWord As Integer = 0 To arWords.Length - 1  '// Loop thru all Words.
                    If Not arWords(iWord) = Nothing Then '// check if Word is not Nothing, since Words get Split. by " ".
                        If Char.IsLetter(CChar(arWords(iWord).Substring(arWords(iWord).Length - 1, 1))) Then '// …
Rian_3 commented: can you make textbox1 output to textbox2 +0
codeorder 197 Nearly a Posting Virtuoso

See if this helps.

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        WebBrowser1.Navigate("http://google.com/")
    End Sub

    Private Sub WebBrowser1_Navigated(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserNavigatedEventArgs) Handles WebBrowser1.Navigated
        If WebBrowser1.Url.AbsoluteUri = "http://www.google.com/" Then
            WebBrowser1.Navigate(WebBrowser1.Url.AbsoluteUri & "?pass=123456")
        End If
        Me.Text = WebBrowser1.Url.AbsoluteUri
    End Sub
End Class
codeorder 197 Nearly a Posting Virtuoso

See if this helps.
2 Buttons.

Public Class Form1
    Private LocationArray() As String = {"5,40,50,100", "75,125,30,45", "150,90,50,75", "75,40,180,25", "5,200,250,25"}
    Private penBlack As New Pen(Color.Black, 3) '// Default Color.
    Private penRed As New Pen(Color.Red, 3) '// Selection Color.
    Private arTemp() As String = Nothing '// .Split Locations Strings into(location.X, location.Y, width, height)

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.Visible = True
        drawRectangles()
    End Sub

    '// Draw ALL Rectangles as Default Color.
    Private Sub drawRectangles()
        Dim myGraphics As Graphics = Me.CreateGraphics
        For Each rect As String In LocationArray '// Loop thru all Locations Strings.
            arTemp = rect.Split(",") '// Split into 4 Arrays.
            myGraphics.DrawRectangle(penBlack, CInt(arTemp(0)), CInt(arTemp(1)), CInt(arTemp(2)), CInt(arTemp(3))) '// draw Rectangle.
        Next
    End Sub

    '// Draw ALL Rectangles as Default Color AndAlso Draw the SELECTED Rectangle as Selection Color.
    Private Sub drawSelectedRectangle(ByVal RectangleLocationAndSizeFromStringArray As String)
        drawRectangles() '// Redraw all Rectangles to set ALL to Default Color.
        Dim myGraphics As Graphics = Me.CreateGraphics
        arTemp = LocationArray(RectangleLocationAndSizeFromStringArray).Split(",") '// Split into 4 Arrays.
        '// Redraw a Selected Rectangle, with the Selection Color.
        myGraphics.DrawRectangle(penRed, CInt(arTemp(0)), CInt(arTemp(1)), CInt(arTemp(2)), CInt(arTemp(3))) '// draw Rectangle.
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        drawSelectedRectangle(3) '// 4th in LocationArray().
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        drawSelectedRectangle(1) '// 2nd in LocationArray().
    End Sub
End Class
codeorder 197 Nearly a Posting Virtuoso

See if this helps.

MsgBox("Num Name HF" & vbNewLine & "1:      something(11)" & vbNewLine & "2:      somethingelse(22)" & vbNewLine & "3 andsomethingelse 33")

Also, check out this link for a custom message box.

codeorder 197 Nearly a Posting Virtuoso

Also, see if this helps.

Public Class Form1
    Private myFile As String = "C:\test.txt" '// your File to Load/Edit if needed/Save.

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If IO.File.Exists(myFile) Then '// check if File Exists.
            Dim arTemp() As String = IO.File.ReadAllLines(myFile) '// Load File Lines in a String Array.
            Dim sTemp As String = Nothing '// String used to keep only selected File lines.
            Dim bKeepFileLines As String = True '// determine if worth keeping the remaining File Lines or Not.
            For Each fileLine As String In arTemp '// Loop thru all File Lines in the String Array.
                If fileLine.StartsWith("****") Then bKeepFileLines = False '// check if line.StartsWith... and set to False NOT to keep the File Lines.
                If fileLine.StartsWith(";") Then bKeepFileLines = True '// once Locating the ";", it sets to Keep the remaining File Lines.
                If bKeepFileLines = True Then '// if set to True, keep the File Lines.
                    If Not sTemp = Nothing Then '// check if Not Empty, add a Line Break and the Line Content.
                        sTemp &= vbNewLine & fileLine
                    Else '// add only the Line Content.
                        sTemp = fileLine
                    End If
                End If
            Next
            IO.File.WriteAllText(myFile, sTemp) '// Save File back: IO.File.WriteAllText(File Name, File Content to Save)
            MsgBox("File Edited and Saved.", MsgBoxStyle.Information) '// Display confirmation that File has been modified and Saved.
        Else
            MsgBox("File Does Not Exist.", MsgBoxStyle.Critical) '// Display confirmation if File Does Not Exist.
        End If
    End Sub
End Class
codeorder 197 Nearly a Posting Virtuoso

See if this helps.

New Project and No previous Clients.txt File.

'//------ Pre-requisites: 4 TextBoxes (ID/Name/Address/Phone)
'------------------------ 2 Buttons (Add Client/Clear Fields)
'------------------------ 1 ComboBox (Load Client Information) -------\\
Public Class Form1
    Private myClientsFile As String = "C:\Users\codeorder\Desktop\Clients.txt" '// your File to Load / Save.
    Private arlClients As New ArrayList '// keeps all Clients Information.
    Private iClientID As Integer = 1 '// ID #.

    '//--------- Save File. --------------\\
    Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        Dim myWriter As New IO.StreamWriter(myClientsFile)
        For Each itm As String In arlClients '// Loop thru all Clients in the ArrayList.
            myWriter.WriteLine(itm) '// write each Client on a new line.
        Next
        myWriter.Close()
    End Sub

    '//--------- Load File if Exists. --------------\\
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If IO.File.Exists(myClientsFile) Then '// check if File Exists.
            arlClients.AddRange(IO.File.ReadAllLines(myClientsFile)) '// Load your Clients File in the ArrayList.
            Dim arTemp() As String = Nothing '// String Array to .Split the File Lines into Arrays.
            For Each itm As String In arlClients '// Loop thru all Clients that were added to the ArrayList.
                arTemp = itm.Split("~") '// .Split Line by your selected char.
                '// check if String Array 1 is greater than the last added ID, if so, change the iClientID.
                If CInt(arTemp(0)) > iClientID Then iClientID = CInt(arTemp(0))
                ComboBox1.Items.Add(arTemp(1)) '// add only Client Name to ComboBox.
            Next
            iClientID += 1 '// increase for Next available ID.
        Else '//-------- TESTING PURPOSES TO DETERMINE TEXTBOXES.
            TextBox2.Text = "name" : TextBox3.Text …
Viperino commented: Very helpful. +1
codeorder 197 Nearly a Posting Virtuoso

Late night programming and extra Parameters, could cause a bit of confusion.

Although the code posted in the original post of this thread will work,
..I did realize that an extra Parameter was added to the Function.
(whispering - "probably added by Santa Claus since I stole his goodie bag and he's still looking for it":D)

Here is the updated version.

Public Class Form1

    Function centerForm(ByVal Form_to_Center As Form) As Point
        Dim pLocation As New Point
        pLocation.X = (Me.Left + (Me.Width - Form_to_Center.Width) / 2) '// set the X coordinates.
        pLocation.Y = (Me.Top + (Me.Height - Form_to_Center.Height) / 2) '// set the Y coordinates.
        Return pLocation '// return the Location to the Form it was called from.
    End Function

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Form2.ShowDialog()
    End Sub
End Class
Public Class Form2

    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.Location = Form1.centerForm(Me) '// center Form of Main Form.
    End Sub
End Class
Jake.20 commented: Nice post. I know someday this code will help me. +1
codeorder 197 Nearly a Posting Virtuoso

Since you mentioned that you have a File with just one line as my "test.txt" File,

1/2/3/4/

..see if this helps.

Dim myFile As String = "C:\test.txt" '// your File.
        If IO.File.Exists(myFile) Then '// check if File Exists.
            '// read Text from File and Split into Arrays by the "/" char.
            Dim z() As String = IO.File.ReadAllText(myFile).Split("/")
            TextBox1.Text = z(0) '// Array 1.
            TextBox2.Text = z(1) '// Array 2.
            TextBox3.Text = z(2) '// Array 3.
            TextBox4.Text = z(3) '// Array 4.
        End If
codeorder 197 Nearly a Posting Virtuoso

See if this helps.

'//----- Pre-requisites: 4 TextBoxes. -------\\
        Dim arTemp() As String = {"text 1", "text 2", "text 3", "text 4"}'// your Array.
        TextBox1.Text = arTemp(0)
        TextBox2.Text = arTemp(1)
        TextBox3.Text = arTemp(2)
        TextBox4.Text = arTemp(3)
FrodoBaggins commented: Thanks for help, and solving my problem +0
codeorder 197 Nearly a Posting Virtuoso

See if this helps.

'//----- Pre-requisites: 3 Buttons, and a TON of CheckBoxes. ----------\\
Public Class Form1
    Private arCB() As String = Nothing '// string Array to store the CheckBoxes Names and CheckStates.

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Button1.Text = "save"
        Button2.Text = "clear"
        Button3.Text = "load"
    End Sub

    '// Save Names and CheckStates as Arrays to arCB.
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim sTemp As String = "" '// string to add Names and CheckStates to Split into Arrays.
        For Each ctl As Control In Me.Controls '// loop thru all Controls.
            If TypeOf (ctl) Is CheckBox Then '// check if Control Is CheckBox.
                Dim cb As CheckBox = ctl '// declare CheckBox to get CheckState.
                sTemp &= "~" & cb.Name & "#" & cb.CheckState '// add CheckBox.Name and "#" and CheckBox.CheckState
                '//--- "#" is used to split Array again to extract CheckBox.Name and CheckBox.CheckState
            End If
        Next
        arCB = sTemp.Split("~") '// add each CheckBox.Name and CheckBox.CheckState as a Array.
    End Sub

    '// clear CheckBoxes.CheckStates. -- TESTING PURPOSES ONLY.
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        For Each ctl As Control In Me.Controls
            If TypeOf (ctl) Is CheckBox Then
                Dim cb As CheckBox = ctl
                cb.Checked = False
            End If
        Next
    End Sub

    '// Load CheckStates from arCB.
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        '//-- start with Index 1 since Index 0 is Empty. …
codeorder 197 Nearly a Posting Virtuoso

See if this helps for populating a ListView from a .csv file.

'// file located here: http://seepeoplesoftware.com/downloads/older-versions/11-sample-csv-file-of-us-presidents.html
        Dim myCSVfile As String = "C:\USPresident Wikipedia URLs Thmbs HS.csv"
        '// read File into Arrays.
        Dim arFileLines() As String = IO.File.ReadAllLines(myCSVfile)
        '// read line 1 to get Columns.
        Dim arLineContent() As String = arFileLines(0).Split(",")
        '// add Columns to ListView.
        ListView1.View = View.Details
        For Each lineArray As String In arLineContent
            ListView1.Columns.Add(lineArray)
        Next
        '//------ populate ListView.
        '// start with line 2 since line 1 is for Columns.
        For i As Integer = 1 To arFileLines.Length - 2 '// -2 to remove the last president. :D
            arLineContent = arFileLines(i).Split(",") '// split line into arrays.
            '// create new item and subitems.
            Dim newLvItem As New ListViewItem
            With newLvItem
                .Text = arLineContent(0) '// add Item.
                For x As Integer = 1 To arLineContent.Length - 1
                    .SubItems.Add(arLineContent(x)) '// add SubItems.
                Next
            End With
            ListView1.Items.Add(newLvItem) '// add to ListView.
        Next
        '------\\
codeorder 197 Nearly a Posting Virtuoso

A Global Declaration should be used for what it is.
There is no reason to add your "id" with the rest of the Global Declarations if only used once.

I would also add my "id" in the "public sub pull_data" if that Sub Procedure ends up having to use the "id" to process code.
If your "public sub pull_data" is needed for other results, not just for when the "id" is needed, Declaring something like "Static id as integer = newid" within that Sub Procedure should keep account for the "id"'s value.

Public Sub pull_data(Optional ByVal newid As Integer = 0)
        Static id As Integer = newid
        ' MsgBox(id)
        'select whatever from whatever where id = id
    End Sub
codeorder 197 Nearly a Posting Virtuoso

the items in the listview should be display in the textboxes in the other form whenever i click select data

See if this helps.

Private Sub ListView2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView2.Click
        If Not ListView2.SelectedItems.Count = 0 Then '// check if item is selected.
            With ListView2.SelectedItems.Item(0)
                Form2.TextBox1.Text = .Text '// column 1.
                Form2.TextBox2.Text = .SubItems(1).Text '// column 2.
                Form2.TextBox3.Text = .SubItems(2).Text '// column 3.
                Form2.TextBox4.Text = .SubItems(3).Text '// column 4.
                '// etc...
            End With
            'Form2.ShowDialog()
        End If
    End Sub

Form2 has 4 TextBoxes for the first few Columns.

Adding more TextBoxes and using the "ListView2.SelectedItems.Item(0).SubItems(#).Text" will get your TextBoxes loaded with the SelectedItem's values.

codeorder 197 Nearly a Posting Virtuoso

See if this helps.

'//----------- Pre-requisites: 3 Buttons, 1 RichTextBox. ---------------\\
Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Button1.Text = "New"
        Button2.Text = "Open"
        Button3.Text = "Save" : Button3.BackColor = Color.LightGreen
        RichTextBox1.Tag = "new" '// set .Tag to determine as New File.
    End Sub
    '// new file.
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        RichTextBox1.Clear() '// clear RichTextBox.
        RichTextBox1.Tag = "new" '// set .Tag to determine as New File.
        Button3.BackColor = Color.LightGreen
    End Sub
    '// open file.
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim ofd As New OpenFileDialog
        ofd.Filter = "RTF Files (*.rtf)|*.rtf|TXT Files (*.txt)|*.txt|All Files (*.*)|*.*"
        If ofd.ShowDialog = Windows.Forms.DialogResult.OK Then
            If ofd.FileName.ToLower.EndsWith(".rtf") Then '// determine if a .RTF File.
                RichTextBox1.LoadFile(ofd.FileName, RichTextBoxStreamType.RichText)
            Else
                RichTextBox1.LoadFile(ofd.FileName, RichTextBoxStreamType.PlainText)
            End If
            RichTextBox1.Tag = ofd.FileName '// set .Tag to FileName.
            Button3.BackColor = Color.LightGreen
        End If
    End Sub
    '// save file.
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        If Not RichTextBox1.Tag = "new" Then '// check if .Tag is NOT a NEW File.
            If RichTextBox1.Tag.ToString.ToLower.EndsWith(".rtf") Then '// determine if a .RTF File.
                RichTextBox1.SaveFile(RichTextBox1.Tag.ToString, RichTextBoxStreamType.RichText)
            Else
                RichTextBox1.SaveFile(RichTextBox1.Tag.ToString, RichTextBoxStreamType.PlainText)
            End If
            Button3.BackColor = Color.LightGreen
            MsgBox("File Saved.")
            Exit Sub '// skip the SaveFileDialog.
        End If

        Dim sfd As New SaveFileDialog
        sfd.Filter = "RTF Files (*.rtf)|*.rtf|TXT Files (*.txt)|*.txt|All Files (*.*)|*.*"
        If sfd.ShowDialog = Windows.Forms.DialogResult.OK Then
            If sfd.FileName.ToLower.EndsWith(".rtf") Then '// determine if a .RTF File.
                RichTextBox1.SaveFile(sfd.FileName, RichTextBoxStreamType.RichText)
            Else
                RichTextBox1.SaveFile(sfd.FileName, RichTextBoxStreamType.PlainText)
            End If
            RichTextBox1.Tag = sfd.FileName …
TechSupportGeek commented: Couldn't be more helpful! +2
codeorder 197 Nearly a Posting Virtuoso

Let's take the "other" programmer's example and see what results we get.

Dim stringSomething As String = "some string"
stringSomething = "some other string"
MsgBox(stringSomething)

Total characters: 109

Now let's take "your" example.

Dim strSomething As String = "some string"
strSomething = "some other string"
MsgBox(strSomething)

Total characters: 100

... Now, 9 characters difference is not a big deal, but when constantly reused, "it is a big deal".
Here are a few reasons why.

1. The less code for an application to locate and process, the quicker the application. Correct?
2. The less time you waste typing extra "unnecessary" characters, the quicker you get results done. Correct?
3. The less time your application takes to respond to some code, the less "electricity" used. Correct?
4. The less electricity used, the more we have to offer to the future of our world, resources wise. Correct?
... This not only pertains to "electricity", but everything else, including hard-drive space, less usage of processor(s), among all that relates to a computer.
... If needed be said, the resources we use while typing "unnecessary" characters should also be taken in consideration. Food, water, etc.
5. The less time "the rest of the world" wastes to download/install your "extra characters", ... You do the math.

Overall, I can probably write an entire book on this thread topic alone.:D
But personally, I think that I have provided all the information needed within …

codeorder 197 Nearly a Posting Virtuoso

See if this helps.

Public Class Form1

    Private myCoolFile As String = "C:\test.txt" '// your File to Save/Load from.

    Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        '//------ Save File ------------------------------------------\\
        Dim myWriter As New IO.StreamWriter(myCoolFile)
        For Each myItem As ListViewItem In ListView1.Items '// loop thru all items in ListView.
            With myItem
                '// write Item & "#" & SubItems... "#" is used for when loading each line and splitting it into arrays.
                myWriter.WriteLine(myItem.Text & "#" & .SubItems(1).Text & "#" & .SubItems(2).Text & "#" _
                                   & .SubItems(3).Text & "#" & .SubItems(4).Text & "#" & .SubItems(5).Text)
            End With
        Next
        myWriter.Close()
    End Sub


    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        '// customize ListView.
        ListView1.View = View.Details
        With ListView1.Columns
            '// .Add(column name, column width)
            .Add("column 1", 75) : .Add("column 2", 75) : .Add("column 3", 75) : .Add("column 4", 75)
            .Add("column 5", 75) : .Add("column 6", 75)
        End With
        '//------ Load File ------------------------------------------\\
        If IO.File.Exists(myCoolFile) Then '// check if File exists.
            Dim myCoolFileLines() As String = IO.File.ReadAllLines(myCoolFile) '// load your File as a string array.
            For Each line As String In myCoolFileLines '// loop thru array list of File lines.
                Dim lineArray() As String = line.Split("#") '// separate by "#" character.
                Dim newItem As New ListViewItem(lineArray(0)) '// add text Item.
                With newItem.SubItems
                    .Add(lineArray(1)) '// add SubItem 1.
                    .Add(lineArray(2)) '// add SubItem 2.
                    .Add(lineArray(3)) '// add SubItem 3.
                    .Add(lineArray(4)) '// add SubItem 4.
                    .Add(lineArray(5)) '// add SubItem 5.
                End With
                ListView1.Items.Add(newItem) '// add Item to ListView. …
codeorder 197 Nearly a Posting Virtuoso

See if this helps.

For Each lvItem As ListViewItem In ListView1.Items
            If lvItem.Checked = True Then
                Dim newLvItem As New ListViewItem(lvItem.Text)
                '//-- if it contains subitems. --\\
                'newLvItem.SubItems.Add(lvItem.SubItems(1).Text)
                'newLvItem.SubItems.Add(lvItem.SubItems(2).Text)
                ListView2.Items.Add(newLvItem)
                ListView1.Items.Remove(lvItem)
            End If
        Next
codeorder 197 Nearly a Posting Virtuoso

See if this helps.

Public Class Form1

    Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
        Dim myGraphics As Graphics = e.Graphics
        '// draw Dots.
        Dim myDotPen As New Pen(Color.SteelBlue, 10) '// set DOT pen color and width.
        myGraphics.DrawEllipse(myDotPen, 25, 25, 10, 10) '// (preset pen, location.X, location.Y, width, height)
        myGraphics.DrawEllipse(myDotPen, 75, 25, 10, 10) '// (preset pen, location.X, location.Y, width, height)
        myGraphics.DrawEllipse(myDotPen, 125, 25, 10, 10) '// (preset pen, location.X, location.Y, width, height)
        '// draw Line.
        Dim myLinePen As New Pen(Color.SpringGreen, 5) '// set LINE pen color and width.
        myGraphics.DrawLine(myLinePen, 28, 30, 132, 30) '// (preset pen, startLocation.X, startLocation.Y, endLocation.X, endLocation.Y)
        '// dispose if not needed.
        myGraphics.Dispose() : myDotPen.Dispose() : myLinePen.Dispose()
    End Sub
End Class
AndreRet commented: Nice execution... +4
codeorder 197 Nearly a Posting Virtuoso
Dim tempStr As String = "C:\Reading files\bin\Debug\path.txt';"
        MsgBox(tempStr.Substring(0, tempStr.Length - 2)) '// "0" = start Index, "tempStr.Length - 2" = Substring length.
Trle94 commented: tnx :D +0
codeorder 197 Nearly a Posting Virtuoso

See if this helps.

'//------- Pre-requisites: 1 Button, 1 TextBox named "phonenumbertxtbox". -------\\
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        With phonenumbertxtbox
            If Not .Text = Nothing Then '// check if not empty.
                If .Text.Length > 0 AndAlso .Text.Substring(0, 1) = "(" Then '// check if length is greater than 0 and if first char. is "(".
                    If .Text.Length > 4 AndAlso .Text.Substring(4, 1) = ")" Then '// check if length is greater than 4 and if 5th char. is ")".
                        If .Text.Length > 8 AndAlso .Text.Substring(8, 1) = "-" Then '// check if length is greater than 8 and if 9th char. is "-".
                            MsgBox("Correct")
                        Else : MsgBox("Incorrect")
                        End If
                    Else : MsgBox("Incorrect")
                    End If
                Else : MsgBox("Incorrect")
                End If
            End If
        End With
    End Sub


    Private Sub phonenumbertxtbox_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles phonenumbertxtbox.KeyPress
        Select Case e.KeyChar
            Case "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "(", ")", "-", vbBack '// your pre-selected Characters and Backspace.
                e.Handled = False '// allow.
            Case Else
                e.Handled = True '// block.
        End Select
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        phonenumbertxtbox.MaxLength = 13 '// set max. allowed characters.
    End Sub
End Class
Manny_1 commented: How can I convert this code without a button click +0
codeorder 197 Nearly a Posting Virtuoso

See if this helps.

Public Class Form1

    Private myImg(10) As Bitmap '// create Bitmap Array to store images.
    Private myImgAM As New Bitmap("C:\AM.png")
    Private myImgPM As New Bitmap("C:\PM.png")

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        '// add Images to Arrays in set order.
        myImg(0) = New Bitmap("C:\0.png")
        myImg(1) = New Bitmap("C:\1.png")
        myImg(2) = New Bitmap("C:\2.png")
        myImg(3) = New Bitmap("C:\3.png")
        myImg(4) = New Bitmap("C:\4.png")
        myImg(5) = New Bitmap("C:\5.png")
        myImg(6) = New Bitmap("C:\6.png")
        myImg(7) = New Bitmap("C:\7.png")
        myImg(8) = New Bitmap("C:\8.png")
        myImg(9) = New Bitmap("C:\9.png")
        '// start timer.
        Timer1.Enabled = True
    End Sub

    Private Sub displayTime()
        Dim x As String = Format(TimeOfDay, "hhmmsstt") '// get Hours, Minutes, Seconds, AM/PM.
        PictureBox1.Image = myImg(CInt(x.Substring(0, 1))) '// (h)hmmsstt.
        PictureBox2.Image = myImg(CInt(x.Substring(1, 1))) '// h(h)mmsstt.
        PictureBox3.Image = myImg(CInt(x.Substring(2, 1))) '// hh(m)msstt.
        PictureBox4.Image = myImg(CInt(x.Substring(3, 1))) '// hhm(m)sstt.
        PictureBox5.Image = myImg(CInt(x.Substring(4, 1))) '// hhmm(s)stt.
        PictureBox6.Image = myImg(CInt(x.Substring(5, 1))) '// hhmms(s)tt.
        If x.Substring(6, 2) = "AM" Then '// hhmmss(tt).
            PictureBox7.Image = myImgAM
        Else
            PictureBox7.Image = myImgPM
        End If
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        displayTime()
    End Sub
End Class
AndreRet commented: Nicely executed. +4
codeorder 197 Nearly a Posting Virtuoso

See if this helps, if not, do post code.

Dim tempStr As String = RichTextBox1.Rtf '// store Format into String.
        RichTextBox1.Clear() '// clear if needed.
        If RichTextBox1.WordWrap = True Then : RichTextBox1.WordWrap = False : Else : RichTextBox1.WordWrap = True : End If '// toggle WordWrap.
        RichTextBox1.Rtf = tempStr '// set Formated text back.
codeorder 197 Nearly a Posting Virtuoso

Not so clear on your reply.
Does your File only contain one line of "TFTTTTTTFFTFTFTTTTFF"?, and are you trying to separate each character into an array?

jual.vimaxterpercaya commented: BONEKA FULL BODY ELECTRIC ini terbuat dari bahan pilihan yang lembut, fleksibel dan berkualitas sehingga tidak menimbulkan penyakit dan iritasi pada kulit. UKURAN : panjang : 165cm berat : 4kg BONEKA FULL BODY ELECTRIC dapat di pompa dan di kemas, d +0
codeorder 197 Nearly a Posting Virtuoso

:)
Try this modification.

'//--- THIS FILE WILL BE REMOVED FROM MY WEBSITE ONCE THREAD IS SOLVED ---\\
        Dim linkUrl As String = "http://www.codeorder.net/files/tempTestFile.html" '//-- used for testing only.
        '//--- THE FILE CONTENT IN THE LINK ABOVE IS EXACTLY THE CONTENT PREVIOUSLY POSTED BY "killerbeat" ---\\
        Try
            Dim myResponse As Net.HttpWebResponse = Net.HttpWebRequest.Create(linkUrl).GetResponse '// connect.
            Dim myStream As IO.Stream = myResponse.GetResponseStream() '// get.
            Dim myReader As New IO.StreamReader(myStream) '// read.

            Dim myWebFileInfo As String = myReader.ReadToEnd '// get innerHtml of Page.
            
            '// close reader, information stream, and connection.
            myReader.Close() : myStream.Close() : myResponse.Close()

            '// get location of <pre> by index.
            Dim myStartIndex As Integer = myWebFileInfo.IndexOf("<pre>") + 5 '// add +5 to not add "<pre>" to final result.
            '// get location of </pre> by index.
            Dim myEndIndex As Integer = myWebFileInfo.IndexOf("</pre>")
            '// subtract to get a total number for the substring length result.
            Dim myStringLengthToExtract As Integer = myEndIndex - myStartIndex

            '// extract string.
            myWebFileInfo = myWebFileInfo.Substring(myStartIndex, myStringLengthToExtract)
            '// split into string arrays.
            Dim myHtmlTextLines() As String = myWebFileInfo.Split(vbNewLine.ToCharArray)
            '// display result.
            For Each line As String In myHtmlTextLines '// loop thru each line.
                If Not line.StartsWith(" ") Then '// do not add empty lines.
                    If TextBox1.Lines.Length = 0 Then
                        TextBox1.Text &= line & vbNewLine & vbNewLine '// add an empty line after line 1.
                    Else
                        TextBox1.Text &= line & vbNewLine
                    End If
                End If
            Next
            '// remove HTML formatting.
            With TextBox1 : .Text = .Text.Replace("<b>", "") : .Text = .Text.Replace("</b>", "") : End With

        Catch …
codeorder 197 Nearly a Posting Virtuoso

See if this helps.

'// Prerequisites: 3 Buttons
        Dim myCoolControls() As Control = {Button1, Button2, Button3}
        For Each onlyCoolControl As Control In myCoolControls : onlyCoolControl.BackColor = Color.SteelBlue : Next
jdsurgeon commented: I got you dude. +1
codeorder 197 Nearly a Posting Virtuoso
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
        Select Case e.KeyChar
            Case "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", vbBack '// numeric and backspace.
                Exit Sub
            Case Else
                e.Handled = True
        End Select
    End Sub

Should work.
Using shortcut keys to Cut, Copy, Paste does not.

xfrolox commented: Good and easy +1
codeorder 197 Nearly a Posting Virtuoso

See if this helps.
Prerequisites: 1 ListView, 1 Button.

Public Class Form1

    Private myCoolFile As String = "C:\test.txt" '// your file.

    Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        Dim myWriter As New IO.StreamWriter(myCoolFile)
        For Each myItem As ListViewItem In ListView1.Items
            myWriter.WriteLine(myItem.Text & "#" & myItem.SubItems(1).Text) '// write Item and SubItem.
        Next
        myWriter.Close()
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ListView1.View = View.Details : ListView1.Columns.Add("column 1") : ListView1.Columns.Add("column 2")

        If IO.File.Exists(myCoolFile) Then '// check if file exists.
            Dim myCoolFileLines() As String = IO.File.ReadAllLines(myCoolFile) '// load your file as a string array.
            For Each line As String In myCoolFileLines '// loop thru array list.
                Dim lineArray() As String = line.Split("#") '// separate by "#" character.
                Dim newItem As New ListViewItem(lineArray(0)) '// add text Item.
                newItem.SubItems.Add(lineArray(1)) '// add SubItem.
                ListView1.Items.Add(newItem) '// add Item to ListView.
            Next
        End If
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Static i As Integer = 0
        Dim newItem As New ListViewItem("item " & i) '// add text Item.
        newItem.SubItems.Add("subitem " & i) '// add SubItem.
        ListView1.Items.Add(newItem) '// add Item to ListView.
        i += 1
    End Sub
End Class
killerbeat commented: Great Snipped, thanks +1
codeorder 197 Nearly a Posting Virtuoso
Private Sub TabControl1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TabControl1.SelectedIndexChanged
        Select Case TabControl1.SelectedIndex
            Case 0
                MsgBox("Tab 1 Activated.")
            Case 1
                MsgBox("Tab 2 Activated.")
        End Select
    End Sub
codeorder 197 Nearly a Posting Virtuoso

If the file is exactly as you posted and each line does not have any extra spaces added to the end of the line, the project should respond as asked.

Copy and Paste the entire source code in a new Project.

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        '// customize Form.
        Me.Size = New Size(415, 300) : Me.Icon = SystemIcons.Information : Me.MaximizeBox = False
        '// create and customize a ListView.
        Dim myListView As New ListView With {.Location = New Point(0, 0), .Dock = DockStyle.Fill, .View = View.Details, _
                                                             .FullRowSelect = True, .Font = New Font("Verdana", 10)}
        With myListView.Columns '// (column name, column width, column alignment)
            .Add("Rank", 45, HorizontalAlignment.Center) : .Add("Team", 150) : .Add("Won", 45, HorizontalAlignment.Center)
            .Add("Lost", 45, HorizontalAlignment.Center) : .Add("Percentage", 90, HorizontalAlignment.Center)
        End With
        '// add ListView to Form.
        Me.Controls.Add(myListView)

        Dim sortArray As New ArrayList '// array list to store modified strings (file lines).
        Dim tempString As String = String.Empty  '// string for modifying array strings.
        Dim myCoolFile As String = "C:\test.txt" '// your file.

        If IO.File.Exists(myCoolFile) Then '// check if file exists.
            Dim myCoolFileLines() As String = IO.File.ReadAllLines(myCoolFile) '// load your file lines as string arrays.
            For i As Integer = 0 To myCoolFileLines.Count - 1 '// for each array.
                Dim myArray() As String = myCoolFileLines(i).Split(" ") '// separate each line into arrays by space.
                If myArray.Length = 4 Then '// if array contains a City with 2 words.
                    tempString = myArray(2) & "#" '// add games won.
                    tempString …
codeorder 197 Nearly a Posting Virtuoso

Just to create or overwrite a .txt file, try the following code.

Button1.Visible = False
        Button2.Visible = False
        Label5.Visible = False
        '/////////////////////////////
        Dim myCoolFile As String = "C:\myCoolTestFile.txt" '// your file location.
        IO.File.WriteAllText(myCoolFile, TextBox1.Text & " / " & MaskedTextBox1.Text) '// save to file.
        '/////////////////////////////
        '// display confirmation AFTER saving the file.
        Label3.Text = "Your information has been saved."
        Label4.Text = ""
eikal commented: Great thanks +1
codeorder 197 Nearly a Posting Virtuoso
Imports System.IO

Public Class Form1

    Private file_name As String = "jpeg.rtf"
    Private tempString As String = Date.Now

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        '/////////////////////////////
        tempString = tempString.Replace("/", "-")
        '// unless you replace these character, the file name returns invalid and causes errors.
        tempString = tempString.Replace(":", ".")
        '////////////////////////////
        Dim path1 As String = Trim("D:\frs\files\" & file_name)
        Dim path2 As String = Trim("D:\frs\versions\" & tempString & " " & file_name) '// modified.
        File.Copy(path1, path2)
        MsgBox("File copied to:" & vbNewLine & path2)
        End
    End Sub
End Class

As mentioned, you are trying to create a file with invalid characters for the file name.
Also, you are trying to copy the file to a folder that does not exist so I modified the code in path2.

One more thing, your declared variable "Now" might conflict with the vb.net code for Now.
Try using something that does not cause/or could cause conflicts.

Hope this helps.

guptas commented: Very accurate reply. +1
codeorder 197 Nearly a Posting Virtuoso

See if this helps.

Public Class Form1

    '// your application's folder that contains all Forms.
    Private myAppFolder As String = "C:\Users\codeorder\Desktop\vb.net\WindowsApplication1\WindowsApplication1"

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim myCoolFileLineCount As Integer = 0
        For Each myCoolFile As String In My.Computer.FileSystem.GetFiles _
                                      (myAppFolder, FileIO.SearchOption.SearchTopLevelOnly, "*.*") '// scan folder.
            If IO.Path.GetExtension(myCoolFile) = ".vb" Then '// get all files with the .vb file extension.
                If Not IO.Path.GetFileName(myCoolFile).Contains(".Designer.vb") Then '// remove files that are Designer files.
                    Dim myCoolForm As String = IO.Path.GetFullPath(myCoolFile) '// get full path of file.
                    Dim myCoolFileLines() As String = IO.File.ReadAllLines(myCoolForm) '// load your file as a string array.
                    myCoolFileLineCount += myCoolFileLines.Length '// count lines and add to the sum total.
                End If
            End If
        Next
        '// display your application's total code line count.
        MsgBox(Application.ProductName & vbNewLine & "Total Code Lines Count: " & myCoolFileLineCount, MsgBoxStyle.Information)
    End Sub

End Class

Please supply the proper information when FIRST asking a question.
Thank you.

Simran Kaur commented: was helpful +1
codeorder 197 Nearly a Posting Virtuoso

Does using (sender, e) help?

Public Class Form1

    Private Sub Button2_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
        Button2.BackColor = Color.Orange
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Button2_MouseMove(sender, e)
    End Sub
End Class
codeorder 197 Nearly a Posting Virtuoso
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        WebBrowser1.Navigate("http://www.ritani.com/salespersons/login")
    End Sub

    Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted

        If WebBrowser1.Url.AbsoluteUri = "http://www.ritani.com/salespersons/login" Then
            WebBrowser1.Document.GetElementById("SalespersonEmail").SetAttribute("Value", "myCoolEmail@myCoolWebsite.com")
            WebBrowser1.Document.GetElementById("SalespersonPassword").SetAttribute("Value", "myCoolPassword")
            WebBrowser1.Document.Forms(1).InvokeMember("submit")
        End If

    End Sub

You might find this link useful.