codeorder 197 Nearly a Posting Virtuoso

Question:
Is txtAddress1 a ComboBox or TextBox?

codeorder 197 Nearly a Posting Virtuoso

The following code will play .wav files.

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim myCoolSoundFile As String = "C:\!vb.net\mission2.wav" '// your sound .wav file here.
        If IO.File.Exists(myCoolSoundFile) Then
            My.Computer.Audio.Play(myCoolSoundFile)
        Else
            MsgBox("No sound file found.", MsgBoxStyle.Critical)
        End If
    End Sub
End Class
codeorder 197 Nearly a Posting Virtuoso

How is it adding the date and time to your Form's Title? Me.Text=""?

Have you tried adding the name of your Form's title first, followed by & and the code I have provided?

codeorder 197 Nearly a Posting Virtuoso
Me.Text = Date.Now.ToLongDateString & " - " & TimeOfDay
codeorder 197 Nearly a Posting Virtuoso

You can move the code to the appropriate events for the Panel and set AllowDrop to True in the Panel's Properties, or you can just simply modify the Form1_Load event.

Example:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Panel1.AllowDrop = True
        AddHandler Panel1.DragEnter, AddressOf Form1_DragEnter
        AddHandler Panel1.DragDrop, AddressOf Form1_DragDrop
    End Sub
codeorder 197 Nearly a Posting Virtuoso

The following code will allow you to drop files on your form and get their full path.
Since it will return a file's full path, the rest should be easy.

The code had to be slightly modified for it to respond properly, and originated from here.

Imports System.IO
Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.AllowDrop = True
        AddHandler Me.DragEnter, AddressOf Form1_DragEnter
        AddHandler Me.DragDrop, AddressOf Form1_DragDrop
    End Sub

    Private Sub Form1_DragEnter(ByVal sender As Object, ByVal e As DragEventArgs)
        If e.Data.GetDataPresent(DataFormats.FileDrop) Then
            e.Effect = DragDropEffects.Copy
        Else
            e.Effect = DragDropEffects.None
        End If
    End Sub

    Private Sub Form1_DragDrop(ByVal sender As Object, ByVal e As DragEventArgs)
        If e.Data.GetDataPresent(DataFormats.FileDrop) Then
            Dim filePaths As String() = CType(e.Data.GetData(DataFormats.FileDrop), String())
            For Each fileLoc As String In filePaths
                '////////////////////////////////////////////////////
                If File.Exists(fileLoc) Then
                    MsgBox("Full Path: " & vbNewLine & Path.GetFullPath(fileLoc))
                End If
                '////////////////////////////////////////////////////
            Next
        End If
    End Sub
End Class
nv136 commented: Great coding! +1
codeorder 197 Nearly a Posting Virtuoso

hello
you may use "settings" to store settings
project properties> settings> valid Boolean user false

then in the load event

If Not My.Settings.valid Then
            'ask for the serial
        End If

Just simplifying the above quote.

From the vb.net top Menu, click Project and select yourApplication Properties...
Locate the Settings Tab and add "valid" as your setting Name.
Change the Type to Boolean and set the Value to "False".

The following code should explain it's self.

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If My.Settings.valid = True Then '// check if valid has been set to True
            Form2.Show()
            Me.Close()
        End If
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If My.Settings.valid = False Then
            If TextBox1.Text = "12345" And TextBox2.Text = "12345" And TextBox3.Text = "12345" _
                And TextBox4.Text = "12345" And TextBox5.Text = "12345" And TextBox6.Text = "12345" Then
                My.Settings.valid = True '// set the valid Setting to True
                My.Settings.Save() '// save your Settings
                Form2.Show()
                Me.Close()
            Else
                MsgBox("Incorrect Serial Number")
            End If
        Else
            Form2.Show()
            Me.Close()
        End If
    End Sub
End Class

The only way I could get the code to work was to set the Shutdown Mode to "When last form closes" in the Application Tab of the Project's Properties.

codeorder 197 Nearly a Posting Virtuoso
Private Sub ListView1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListView1.MouseUp
        If ListView1.SelectedItems.Count > 0 Then
            MsgBox(ListView1.SelectedItems.Item(0).Index, MsgBoxStyle.Information)
        End If
    End Sub
codeorder 197 Nearly a Posting Virtuoso
Private mouse_Click As Integer = 0 '// keep track of clicks.

    Private Sub Button1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) _
        Handles Button1.MouseClick, Button2.MouseClick, ListBox1.MouseClick, TextBox1.MouseClick, TextBox2.MouseClick, _
         TextBox3.MouseClick
        mouse_Click += 1 '// increase count by 1.
        Me.Text = mouse_Click
    End Sub
codeorder 197 Nearly a Posting Virtuoso

Just adding my 2 cents worth.

In the File Menu, Project/Properties, Application Tab, you can locate the Shutdown Mode: Options which allow you to Shutdown the application "When startup form closes" or "When last form closes".

Selecting when last form closes, always show the other form first, then close the current one. example:

Form2.Show()
        Me.Close()

Closing a Form, the current data set on the Form will be reset to the original data of the Form. For example, having a Textbox on Form1 and using the above code, if you had text typed into the Textbox, the text will be lost.

In the case that you want to keep the data as is on a Form, use the .Hide() option.

codeorder 197 Nearly a Posting Virtuoso
Public Class Form1

    Sub keepCentered()
        Dim x As Integer = CInt((Me.Left + (Me.Width - Form2.Width) / 2))
        Dim y As Integer = CInt((Me.Top + (Me.Height - Form2.Height) / 2))
        Form2.Location = New Point(x, y)
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Form2.Show()
        Form2.TopMost = True
        keepCentered()
        Me.Location = New Point(1290, 155)
    End Sub

    Private Sub Form1_Move(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Move
        keepCentered()
    End Sub

End Class
xfrolox commented: Cuz it worked :P +1
codeorder 197 Nearly a Posting Virtuoso
Dim lines As String() = IO.File.ReadAllLines("C:\!vb.net\temp.txt") '// your file here
        For i As Integer = 4 To lines.Count - 1 '// start at line 5
            ListView1.Items.Add(lines(i))
        Next
codeorder 197 Nearly a Posting Virtuoso

Assuming that you are using the vb.net webbrowser, read on.
If this is for a login to a website, the link should have an Id. For example, using the following html page to navigate to,

<html><head><title>Untitled Page</title></head>
<body>
<a href="http://www.daniweb.com" id="myLink">to be clicked link</a>
</body>
</html>

and using the following code to get the proper link by id,

Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
        For Each link As HtmlElement In WebBrowser1.Document.Links
            If link.Id = "myLink" Then
                WebBrowser1.Navigate(link.GetAttribute("href"))
                Exit For
            End If
        Next
    End Sub

my webbrowser navigates to http://www.daniweb.com.

codeorder 197 Nearly a Posting Virtuoso

Here is something simple using a picturebox, listbox, timer, and a button.

Public Class Form1

    Private myFolder As String = "C:\!vb.net\images\" '// your images folder.

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        For Each img As String In My.Computer.FileSystem.GetFiles _
            (myFolder, FileIO.SearchOption.SearchTopLevelOnly, "*")
            ListBox1.Items.Add(IO.Path.GetFileName(img)) '// load all files from folder into a listbox.
        Next
        Timer1.Interval = 2000
        PictureBox1.SizeMode = PictureBoxSizeMode.Zoom
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        ListBox1.SelectedIndex = 0 '// select an item.
        Timer1.Start()
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If Not ListBox1.SelectedIndex = ListBox1.Items.Count - 1 Then '// if not last item.
            ListBox1.SelectedIndex += 1
            PictureBox1.Image = Image.FromFile(myFolder & ListBox1.SelectedItem)
        Else '// if last item selected.
            ListBox1.SelectedIndex = 0
            PictureBox1.Image = Image.FromFile(myFolder & ListBox1.SelectedItem)
        End If
    End Sub

End Class