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

Forgot to mention that the previous post of mine, only blocks ads from "openx.org", at least for the most part, if not all.

No personal intentions to harm "openx.org" as a online business, it was just a site that was available to displays ads with the current URL for the WebBrowser.

codeorder 197 Nearly a Posting Virtuoso

Let me know if this helps.
New Project, 1 WebBrowser.

Public Class Form1
    Private sVisitedURL As String = "" '// keeps track of Visited webpage, to not Reload.

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        WebBrowser1.ScriptErrorsSuppressed = True '// since it will throw a few Alerts if not removing/replacing HTML correctly.
        WebBrowser1.Navigate("http://watch-series.com/serie/the_penguins_of_madagascar") '// JUST A RANDOM SITE SELECTED THAT CONTAINED ADS.
    End Sub

    Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
        If Not sVisitedURL = WebBrowser1.Url.AbsoluteUri Then '// Check if same URL to not keep Reloading Page once Modified.
            sVisitedURL = WebBrowser1.Url.AbsoluteUri '// set URL.
            WebBrowser1.Document.Body.InnerHtml = replaceHTML(WebBrowser1.Document.Body.InnerHtml.ToString) '// replace HTML.
        End If
    End Sub

    Function replaceHTML(ByRef wbHTML As String) As String
        '// sStart and sEnd work only with the current WebSite as to when App is Loaded.
        Dim sStart As String = "openx.org" '// change it to "<script" to remove all <SCRIPTS>, NOT RECOMMENDED TO REMOVE SCRIPTS, JUST LINKS.
        Dim sEnd As String = "/" '// change it with: "</script>" to remove all <SCRIPTS>
        Dim iStartIndex, iEndIndex As Integer, iCounter As Integer = 0
        Do While wbHTML.ToLower.Contains(sStart.ToLower)
            iStartIndex = wbHTML.ToLower.IndexOf(sStart.ToLower) '// Locate the Start String.
            iEndIndex = wbHTML.ToLower.IndexOf(sEnd.ToLower, iStartIndex) + sEnd.Length  '//Locate End String + sEnd.Length to include the sEnd.
            '//--- Testing Purpose Only - Displays which Strings will get Replaced with Nothing.
            MsgBox(wbHTML.Substring(iStartIndex, iEndIndex - iStartIndex))
            '---\\
            wbHTML = wbHTML.Replace(wbHTML.Substring(iStartIndex, iEndIndex - iStartIndex), "") '// replace .Substring with "nothing".
            iCounter += 1
        Loop
        MsgBox(iCounter & " …
codeorder 197 Nearly a Posting Virtuoso

See if this helps.
New Project, 2 Forms ( 1 Button(on Form1), 1 Button (on Form2)).

Imports System.Reflection
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim myAssembly As Assembly = Assembly.GetExecutingAssembly()
        For Each myType As Type In myAssembly.GetTypes()
            If myType.Name = "Form2" Then
                Form2.Button1_Click(sender, e)
                Exit For
            End If
        Next
    End Sub
End Class
Public Class Form2

    Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        MsgBox("Button1_Click on Form2.")
    End Sub
End Class
codeorder 197 Nearly a Posting Virtuoso

See if this helps.
New Project, 3 PictureBoxes.

Public Class Form1
  
    '// renamed from "PictureBox1_Click".
    Private Sub myCoolPictureBoxes_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
                                                          Handles PictureBox1.Click, PictureBox2.Click, PictureBox3.Click
        Dim pb As PictureBox = CType(sender, PictureBox) '// get Active PictureBox.
        myImageViewer(pb.Image) '// Call Sub and send the Active PictureBox's Image.
    End Sub

    Private Sub myImageViewer(ByVal selImage As Image)
        '// Create New Form.
        Dim frmImageViewer As New Form With {.FormBorderStyle = Windows.Forms.FormBorderStyle.FixedToolWindow, _
                                                                .MinimizeBox = False, .MaximizeBox = False, .StartPosition = FormStartPosition.CenterScreen}
        '// Create New PictureBox.
        Dim pbImage As New PictureBox With {.Location = New Point(0, 0), .SizeMode = PictureBoxSizeMode.AutoSize}
        pbImage.Image = selImage '// Add image to PictureBox.
        frmImageViewer.Controls.Add(pbImage) '// Add PictureBox to New Form.
        frmImageViewer.ClientSize = pbImage.Size '// Size Form by PictureBox.
        frmImageViewer.Show() '// Display Image.
    End Sub
End Class
codeorder 197 Nearly a Posting Virtuoso

Please post code that causes this new issue.

codeorder 197 Nearly a Posting Virtuoso

Are you asking to Re-size the Image it's self OR change the SizeMode/BackgroundImageLayout of the PictureBox, depending if the image is larger than the PictureBox.Size?

codeorder 197 Nearly a Posting Virtuoso

See if this helps.

Public Class Form1
    Private myImagesFolder As String = Nothing

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        myImagesFolder = "C:\TEMP\" '// your Folder Path.
        For RELREF As Integer = 1 To 30 '// Loop from 1 to 30.
            For Each pb As Control In Me.Controls '// Loop thru all Controls in Form1.
                If TypeOf (pb) Is PictureBox AndAlso pb.Name = "PictureBox" & RELREF Then '// check if Control is PictureBox and Name is "=" to...
                    For Each lbl As Control In Me.Controls '// Loop thru all Controls Again to locate Labels.
                        If TypeOf (lbl) Is Label AndAlso lbl.Name = "Label" & RELREF Then '// check if Control is Label and Name is "=" to...
                            pb.BackgroundImage = Image.FromFile(myImagesFolder & lbl.Text) '// Add Image.
                            Exit For '// Exit Loop once locating Label that Name .EndsWith # as PictureBox.
                        End If
                    Next
                    Exit For '// Exit Loop once locating PictureBox that Name .EndsWith # as RELREF.
                End If
            Next
        Next
    End Sub
End Class
codeorder 197 Nearly a Posting Virtuoso

As previously mentioned, you can locate the "names" of HTML Elements to Target a section of a page, although, I have recently discovered that you can also Target the "id" of an HTML Element.

Hope this helps anyone searching for a similar solution.:)

codeorder 197 Nearly a Posting Virtuoso
MsgBox(ListView1.Items.Count)
codeorder 197 Nearly a Posting Virtuoso

Have you tried ".SubItems.Item(2).Text"?

If Double.TryParse(TempNode.SubItems.Item(2).Text, TempDbl) Then

..Or maybe ".SubItems.Item(1).Text" to get the Unit Price Total of the "second" Column?

codeorder 197 Nearly a Posting Virtuoso

See if this helps.

'// If Button is on Form, use:
        For Each ctl As Control In Me.Controls
            If TypeOf (ctl) Is Button Then
                If ctl.Name = "Button" & l.Text Then
                    ctl.Text = "blabla"
                End If
            End If
        Next

        '// If Button is in a Container, as in a Panel, use:
        For Each ctl As Control In Panel1.Controls
            If TypeOf (ctl) Is Button Then
                If ctl.Name = "Button" & l.Text Then
                    ctl.Text = "blabla"
                End If
            End If
        Next
codeorder 197 Nearly a Posting Virtuoso

See if this helps.

codeorder 197 Nearly a Posting Virtuoso

See if this helps.
1 Button, 1 Panel (for loading image(s)).

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Panel1.AutoScroll = True '// Scrollbar(s) if needed.
        Button1.Text = "Load Images" : Button1.Width = 96
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim ofd As New OpenFileDialog
        With ofd
            .Multiselect = True '// allows to MultiSelect Images/Files.
            .Title = "Please select one or more images to load..." '// Title for the OpenFileDialog.
            '// Filters for Images/Files.
            .Filter = "All Images (*.jpg,*.jpeg,*.gif,*.png,*.bmp)|*.jpg;*.jpeg;*.gif;*.png;*.bmp|" _
                     & "JPEG Images (*.jpg,*.jpeg)|*.jpg;*.jpeg|GIF Images (*.gif)|*.gif|PNG Images (*.png)|*.png|Bitmaps (*.bmp)|*.bmp"
            If .ShowDialog = DialogResult.OK Then
                Panel1.Controls.Clear() '// Clear Previous PictureBox(es).
                Dim iX As Integer = 0 '// Location.X for each PictureBox.
                Dim iPbWidth As Integer = 175, iPbHeight As Integer = 175 '// Preset Width and Height.
                For Each selectedImage As String In .FileNames '// Loop thru all Selected Images.
                    Dim pb As New PictureBox '// Create new PictureBox.
                    pb.Image = Image.FromFile(selectedImage) '// Set Image to new PictureBox.
                    pb.SizeMode = PictureBoxSizeMode.AutoSize '// Set .SizeMode to determine if PictureBox needs to display as "Zoom" or "CenterImage".
                    If pb.Width > iPbWidth OrElse pb.Height > iPbHeight Then '// if image loaded is greater in width/height than the Preset Sizes...
                        pb.SizeMode = PictureBoxSizeMode.Zoom '// Zoom image.
                    Else
                        pb.SizeMode = PictureBoxSizeMode.CenterImage '// Center image.
                    End If
                    pb.Size = New Size(iPbWidth, iPbHeight) '// set preset Size for PictureBox.
                    pb.Location = New Point(iX, 0) '// add Location.
                    pb.BorderStyle = BorderStyle.FixedSingle '// set …
codeorder 197 Nearly a Posting Virtuoso

See if this helps.
Option 1.

Select Case MsgBox("Are you sure to DELETE?", MsgBoxStyle.Critical + MsgBoxStyle.YesNo, "WARNING")
            Case MsgBoxResult.Yes
                MsgBox("YES Clicked.")
            Case MsgBoxResult.No
                MsgBox("NO Clicked.")
        End Select

Option 2.

If MsgBox("Are you sure to DELETE?", MsgBoxStyle.Critical + MsgBoxStyle.YesNo, "WARNING") = MsgBoxResult.Yes Then
            MsgBox("YES Clicked.")
        Else
            MsgBox("NO Clicked.")
        End If

Option 3.

Select Case MessageBox.Show("Are you sure to DELETE?", "WARNING", MessageBoxButtons.YesNo, MessageBoxIcon.Error, MessageBoxDefaultButton.Button2)
            Case DialogResult.Yes
                MsgBox("YES Clicked.")
            Case DialogResult.No
                MsgBox("NO Clicked.")
        End Select

Option 3 can also be used in a If/End If Statement and the selection of which button to be highlighted can also be changed.

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

I believe that is actually a ListView.
..Personally, I use CCleaner as well. Could do better with the Registry, but not complaining. Great software.

codeorder 197 Nearly a Posting Virtuoso

If you just need to extract data from a webpage, see if this helps to extract the "Tags" from the "Tag Cloud" of this page.
New Project, 1 ListBox, 1 WebBrowser.

Public Class Form1

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

    Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
        getItems(WebBrowser1.Document.Body.InnerHtml.Split(vbCrLf), ListBox1)
    End Sub

    Private Sub getItems(ByVal arLines() As String, ByVal selectedListBox As ListBox)
        selectedListBox.Items.Clear() '// Clear in case the webpage reloads.
        For i As Integer = 0 To arLines.Length - 1 '// Loop thru all Strings in the Array.
            If arLines(i).Contains("<DIV class=tagcloud>") Then '// Locate the String that .Contains...
                Dim arTemp() As String = arLines(i).Split(">") '// .Split the entire String into Arrays.
                For Each itm As String In arTemp '// Loop thru all Strings in the Array.
                    If itm.EndsWith("</A") Then '// check if String .EndsWith("</A")
                        itm = itm.Replace("</A", "") '// Remove the HTML Code from String.
                        selectedListBox.Items.Add(itm) '// add Tag Name to ListBox.
                    End If
                Next
                Exit For '// Exit the Loop.
            End If
        Next
    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
Private Sub TextBox1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyUp
        If e.KeyCode = Keys.Return Then
            keyPressed()
        End If
    End Sub

    Sub keyPressed()
        MsgBox("Enter key Pressed.")
    End Sub
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

Using something like:

Form2.ShowDialog()

...and setting the StartPosition to "CenterParent" in Form2's Properties, will work.

However, using just:

Form2.Show()

...even if setting the Form2's Properties for StartPosition to "CenterParent", will NOT WORK.

I am sure there are ways around it other than the code I have posted, and if so, feel free to reply with a solution. After all, this is a "Code Snippet" thread.

The original code I have posted was created for a Window's Application, using the 2.0 .Net Framework.

codeorder 197 Nearly a Posting Virtuoso

If by "slaughtering a Giraffe", you mean poke it's eyes out, then I'm out of luck. Too short and I only have a step ladder.:D
Although, one time, I was in a tree, hiding behind a leaf, and had a 50 foot ladder to poke a giraffe's eyes with:D, but that another story and probably the wrong forum for.

..The last link I have posted, was to give you an idea on how to modify the WebBrowser's content.
First you would have to replace all the similar names with your own, then probably save the content to a file somehow, and load that file with the File's location and the "#some name".
You might also have to replace links within the file saved, for example, a link that is <a href="/somepage/etc.">, might have to be saved w/the URL of the page you are currently viewing, as: <a href="http://www.somesite.com/somepage/etc.">.

As mentioned previously, I have not done much/if any DomDocument editing, but the info I have provided so far for this thread should give you a good start.

codeorder 197 Nearly a Posting Virtuoso

See if this helps.
1 TextBox (MultiLine), 1 Button.

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        TextBox1.Text = getUrlPageContent("http://www.daniweb.com/forums/post1433319.html")
    End Sub
    Function getUrlPageContent(ByVal url As String) As String
        Try
            Dim connect As Net.HttpWebResponse = CType(Net.HttpWebRequest.Create(url).GetResponse, Net.HttpWebResponse) '// connect.
            Dim content As IO.Stream = connect.GetResponseStream()
            Dim reader As New IO.StreamReader(content)
            Dim htmlContent As String = reader.ReadToEnd
            reader.Close() : content.Close() : connect.Close()
            Return htmlContent
        Catch ex As Exception
            MsgBox("There was a connection problem...", MsgBoxStyle.Critical)
            Return Nothing
        End Try
    End Function
End Class
codeorder 197 Nearly a Posting Virtuoso

Check out this link for a better idea on how to modify the webpage inside the WebBrowser.

Good luck with the rest.:)

EDIT:
Just wanted to add.
Why not extract the HTML and only display the selections in the WebBrowser?

codeorder 197 Nearly a Posting Virtuoso

Hopefully these "Html elements" have "names".
For instance, when viewing a webpage's HTML source code, and you locate something similar to:

<div class="shade"> <div class="right"> <a href="/forums/post1433269.html#post1433269" id="postcount1433269" [B]name="4"[/B]>Permalink</a>  </div>   1 Minute Ago

..you have to locate the "name=..." part of the HTML and simply add a "#" and the name, just following the original link of the page.
Example:
http://www.daniweb.com/forums/thread335165.html#4

This usually targets an area of the webpage and scrolls it to the very top of the browser.

If you cannot locate the "name" of something and/or would like to "center" the content of the webpage in the WebBrowser instead of scrolling it to the top, you will have to modify the WebBrowser "DomDocument" and insert "names" in certain locations of the page to use and target.

I personally have not done much, if any DomDocument webpage editing, but hopefully this link might give you an idea on how to get started.

codeorder 197 Nearly a Posting Virtuoso

I'm not quite clear on your question.
..Are you trying to login a website?
..Scroll to a section in the webpage that has been loaded in your vb.net WebBrowser?
..OR just extract the data from a certain section when an item is checked in your CheckedListBox?

Btw, if you are guilty for joining DaniWeb just to ask a question or two, then I am guilty for joining DaniWeb to answer a question, or two.:D

codeorder 197 Nearly a Posting Virtuoso

If your INI File content is exactly as you have posted, see if this helps.

Public Class Form1
    Private myFile As String = "C:\test.txt" '// your File.
    Private arlFileInfo As New ArrayList '// ArrayList to store Information for each Entry.
    Dim arTemp() As String = Nothing '// String Array to use as needed.

    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.
            arTemp = IO.File.ReadAllLines(myFile) '// Read each Line into a String Array.
            For i As Integer = 0 To arTemp.Length - 1 '// Loop thru all Lines.
                If arTemp(i).StartsWith("[Entry") Then '// If Line .StartsWith("[Entry").
                    '// Add 1st, 2nd, and 3rd Lines following the Line that .StartsWith("[Entry") as New Item to your Array List.
                    arlFileInfo.Add(arTemp(i + 1) & "~" & arTemp(i + 2) & "~" & arTemp(i + 3)) '// "~" used to .Split Item when extracting data from Item.
                End If
            Next
        End If
        '//======== DISPLAY RESULT FOR SECOND ENTRY =======
        arTemp = arlFileInfo(1).ToString.Split("~") '// split Item 2 by the "~" char.
        '// Display result.
        MsgBox(arTemp(0) & vbNewLine & arTemp(1) & vbNewLine & arTemp(2), MsgBoxStyle.Information) '======\\
        '//======== DISPLAY RESULT FOR FIRST ENTRY =======
        arTemp = arlFileInfo(0).ToString.Split("~") '// split Item 1 by the "~" char.
        '// Display result.
        MsgBox(arTemp(0) & vbNewLine & arTemp(1) & vbNewLine & arTemp(2), MsgBoxStyle.Information) '======\\
    End Sub
End Class
codeorder 197 Nearly a Posting Virtuoso

See if this helps.
Re: How to mark a thread solved?

Glad I could help otherwise.:)

codeorder 197 Nearly a Posting Virtuoso

Check out this link for some information about Dynamic Controls.

codeorder 197 Nearly a Posting Virtuoso

A simple way is to "use a TabControl".

Try this in a New Project.
Add a Panel, place a TabControl inside the Panel, possibly at .Location(0,0), and add 2 Buttons to the Form.

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        TabControl1.Location = New Point(TabControl1.Location.X, -21) '// move TabControl1 to a .Location.Y where tabs are not visible.
        Button1.Text = "Previous" : Button2.Text = "Next"
    End Sub
    '// Previous.
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If Not TabControl1.SelectedIndex = 0 Then TabControl1.SelectedIndex -= 1 '// Scroll Back thru tabs.
    End Sub
    '// Next.
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        If Not TabControl1.SelectedIndex = TabControl1.TabPages.Count - 1 Then TabControl1.SelectedIndex += 1 '// Scroll Forward thru tabs.
    End Sub
End Class

When the Form Loads, it moves the TabControl1 up. Doing so, the tabs are not visible.
..Having it moved up by code, allows you to edit the tabs as needed while working in .Designer.

A Complex way is to design your entire application to use Dynamic Controls and Add/Remove them as needed.

Let me know if this helps.:)

codeorder 197 Nearly a Posting Virtuoso

See if this helps.

'// Save Image as .txt File.
PictureBox1.Image.Save("C:/test.txt", Imaging.ImageFormat.Png)
'// Load Image from .txt File.
PictureBox1.Image = Image.FromFile("C:/test.txt")
codeorder 197 Nearly a Posting Virtuoso

See if this helps.

Dim rnd As New Random
        MsgBox(question(rnd.Next(0, question.Length)))
codeorder 197 Nearly a Posting Virtuoso

See if this helps.

Public Class Form1
    Private myCoolFile As String = "C:\test.txt" '// your file.
    Private myCoolFileLines() As String = Nothing '// String Array to read File Lines into.
    Private sTemp As String = Nothing '// temp String to be used as needed.

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If IO.File.Exists(myCoolFile) Then '// check if File Exists.
            myCoolFileLines = IO.File.ReadAllLines(myCoolFile) '// load each line from your File as a String Array.
            TextBox1.Text = readFileLine(0) '// line 1 returned from Function.
            TextBox2.Text = readFileLine(1) '// line 2 returned from Function.
        End If
    End Sub

    Function readFileLine(ByVal selectedLine As Integer) As String
        '// get .Substring of selected line, starting from the "=".
        sTemp = myCoolFileLines(selectedLine).Substring(myCoolFileLines(selectedLine).IndexOf("=") + 1)
        Return sTemp '// Return .Substring.
    End Function
End Class
codeorder 197 Nearly a Posting Virtuoso

I downloaded the project, reviewed the files, and all that "non english" makes my head spin trying to figure out what is what.:(

Sorry, but I do not have a solution to provide. Good luck.

codeorder 197 Nearly a Posting Virtuoso

Hello, codeorder. Thank you for your answer.

I've been looking at your code and, to be honest, I'm really not getting this to work because it writes to the file but when I close the application and then open it again, it doesn't load the data stored on it.

Also, can't this be done according to the logic I've been using with lists?

Or, at least can I "incorporate" this id into my code?

Once again, thank you for your answer.

If you want to load the data stored in the file when loading your application again with the code sample I have provided, simply select any Client from the ComboBox.

About having it "done according to the logic I've been using with lists" and/or ""incorporate" this id into my code", please post the entire code you have done so far, possibly with some comments.

I previously have tried to figure out how to provide a solution using your code examples, but due to your code constantly changing and only having bits and pieces of code here and there, I was not able to figure out what is what and how it all connects.

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

In this case, Form1 is the Main Form.

Pre-requisites: 2 Forms (Form1 and Form2), 1 Button (on Form1).

Public Class Form1

    Function centerForm(ByVal Form_to_Center As Form, ByVal Form_Location As Point) 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, Me.Location) '// center Form of Main Form.
    End Sub
End Class

To center any other Form to the Main Form,
add the following code to the selected Form's .Load Event, as shown in the above code block for Form2.

Me.Location = Form1.centerForm(Me, Me.Location) '// center Form of Main Form.
TechSupportGeek commented: Very helpful code snippet demonstrating the use of Functions. +2
codeorder 197 Nearly a Posting Virtuoso

See if this helps.

Public Class Frm
    Private iCtlSpace As Integer = 5 '// used to add spaces between Controls.
    '// all other Controls will set their Locations from this first Control.
    Private cmbprdcde1 As New ComboBox With {.Location = New Point(2, 2), .Width = 92, .Height = 20}
    '// .Location="location of previous Control "+" the previous Control's .Width "+" the space between Controls, and Location.Y of previous Control.
    Private txtCtgry1 As New TextBox With _
        {.Location = New Point(cmbprdcde1.Location.X + cmbprdcde1.Width + iCtlSpace, cmbprdcde1.Location.Y), .Width = 102, .Height = 20}
    Private txtbrnd1 As New TextBox With _
        {.Location = New Point(txtCtgry1.Location.X + txtCtgry1.Width + iCtlSpace, txtCtgry1.Location.Y), .Width = 102, .Height = 20}
    Private txtdesc1 As New TextBox With _
        {.Location = New Point(txtbrnd1.Location.X + txtbrnd1.Width + iCtlSpace, txtbrnd1.Location.Y), .Width = 196, .Height = 20}
    Private txtprce1 As New TextBox With _
        {.Location = New Point(txtdesc1.Location.X + txtdesc1.Width + iCtlSpace, txtdesc1.Location.Y), .Width = 56, .Height = 20}
    Private txtdate1 As New TextBox With _
        {.Location = New Point(txtprce1.Location.X + txtprce1.Width + iCtlSpace, txtprce1.Location.Y), .Width = 102, .Height = 20}
    Private txtqty1 As New TextBox With _
        {.Location = New Point(txtdate1.Location.X + txtdate1.Width + iCtlSpace, txtdate1.Location.Y), .Width = 43, .Height = 20}
    Private txtdscnt1 As New TextBox With _
        {.Location = New Point(txtqty1.Location.X + txtqty1.Width + iCtlSpace, txtqty1.Location.Y), .Width = 51, .Height = 20}
    Private txtsp1 As New TextBox With _
        {.Location = New Point(txtdscnt1.Location.X + txtdscnt1.Width + iCtlSpace, txtdscnt1.Location.Y), .Width = 56, .Height = 20}
    Private ctlRow As Integer …
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
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 Form TextBox.

If IsNumeric(TextBox1.Text) Then
            TextBox1.Text += 1
        End If
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

See if this helps.

Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
        If Asc(e.KeyChar) = 46 Then '// if "dot".
            e.Handled = True '// cancel out the key pressed.
            TextBox1.SelectedText = "- test -" '// replace the selection.
        End If
    End Sub
codeorder 197 Nearly a Posting Virtuoso
Dim dt As Date = "12/13/2010"
        MsgBox(Format(dt, "yyyy-MM-dd"))
codeorder 197 Nearly a Posting Virtuoso

In order to obtain the proper Parameters for your Event Procedure...

(ByVal sender As System.Object, ByVal e As System.EventArgs) ' <--//--- Parameters ---//--

...locate a similar control from the Toolbox and select your event for it.
For this example, I will use the "MouseDown" Event of a Button.

I added a button (Button1) from the Toolbox and located the "MouseDown" Event from the code window.

Private Sub Button1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseDown

    End Sub

The next step is to remove the "Handles Button1.MouseDown" and possibly rename your new Sub Procedure.
The Parameters should be left as is.

Private Sub myCoolDynamicBtn_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)

    End Sub

All that is left is to create new Dynamic Controls and connect them to your new Sub Procedure.

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        '// create and customize Dynamic Control.
        Dim btn1 As New Button With {.Name = "btn1", .Text = "my btn1", .Location = New Point(5, 5), .Size = New Size(55, 55)}
        AddHandler btn1.MouseDown, AddressOf myCoolDynamicBtn_MouseDown '// set Handler.
        Me.Controls.Add(btn1) '// add to Form.

        '// create and customize Dynamic Control.
        Dim btn2 As New Button With {.Name = "btn2", .Text = "my btn2", .Location = New Point(75, 5), .Size = New Size(55, 55)}
        AddHandler btn2.MouseDown, AddressOf myCoolDynamicBtn_MouseDown '// set Handler.
        Me.Controls.Add(btn2) '// add to Form.
    End Sub

    Private Sub myCoolDynamicBtn_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
        Dim btn …
codeorder 197 Nearly a Posting Virtuoso

From what I know about HTML, you cannot click a <span> and have it return something unless it has a option like the "onclick" option.
Example:

<style type="text/css">
span.default_message {color:SteelBlue;font-size:25px;cursor:pointer;}
</style>
 
<span onclick="location.href='http://www.daniweb.com'" class="default_message">Link to DaniWeb.com</span>

Your HTML <span> code uses a CSS class value that sets that <span>'s formatting depending on the CSS.