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
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