How to make a button to send you to 1 form if you have a file and another form if you dont have that

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hello all,so as my topic says i have my code until now,like a set-up file.
First when i click on my button it sends me to the form with the setup steps,when in setups it is copying a identical file into the startup menu.
I want my button to check if i have that file into the startup folder,if i dont have it to send me to the setup if i have it to send me to the form with the program.

I must mention that there are 2 forms,the setup form and the form with the program.
Until now i tried this,but it dosent work so well...

<pre class="prettyprint lang-vb Public Class Form1
Dim OS() As String
Dim UserName() As String

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Install Engine
OS = My.Computer.Info.OSFullName.Split(" ")
UserName = My.User.Name.Split("")
TextBox1.Text = OS(2)
TextBox2.Text = UserName(1)

If OS(2) = "XP" Then
TextBox3.Text = "C:Documents and Settings" & UserName(1) & "Start MenuProgramsStartup" & Application.ProductName & ".exe"
Else
TextBox3.Text = "C:Users" & UserName(1) & "AppDataRoamingMicrosoftWindowsStart MenuProgramsStartup" & Application.ProductName & ".exe"
Install Engine Ending
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Install Engine
If My.Computer.FileSystem.FileExists(Application.ExecutablePath) Then
Me.Hide()
Facebookmanager_ro_.Show()
End If
Me.Hide()
Form2_RO_.Show()
Install Engine Ending
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Install Engine
If My.Computer.FileSystem.FileExists(Application.StartupPath & "TextBox3") Then
Me.Hide()
Facebookmanager_EN_.Show()
Else
Me.Hide()
Form2_EN_.Show()
End If
Install Engine Ending
End Sub

Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click

End Sub
End Class[/code]
<br/>
Please can you show me a template for something like this?its a simple formula that i want...:(
Checks,if i dont have the copy-cat of this file it sends me to the setup where it is copying the file.And if i have the copy-cat in the startup folder then send me to the other form:).
<br/>

View the full article
 
Back
Top