checking if files exist on startup / label array
CODE
Me.label(i).Text = filename(i)
CODE
Private Sub CheckingFiles_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim opentaskID As Double
Dim i As String
Dim filename(5) As String
Dim label(5) As String
Dim path As String = Directory.GetCurrentDirectory()
i = 0
filename(0) = "SAFileMgr.dll"
filename(1) = "Interop.ADODB.dll"
filename(2) = "Interop.FILEMGRLib.dll"
filename(3) = "Interop.MSDATASRC.dll"
filename(4) = "Interop.StdFormat.dll"
filename(5) = "Interop.stdole.dll"
Do While i < 5
' Me.label(i).Text = filename(i)
If File.Exists(path + "\" + filename(i)) = False Then
Dim cross As Image = Image.FromFile(Path + "\x.png")
Me.PictureBox1.Image = cross
Me.PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
Me.PictureBox1.Refresh()
Me.PictureBox1.Visible = True
MsgBox(filename(i) + Chr(13) + "This File Needs To Be In:" + Chr(13) + path, MsgBoxStyle.Critical, "File Not Found")
Application.Exit()
End If
i = i + 1
Loop
opentaskID = Shell("cmd /C regsvr32 SAFileMgr.dll /s", 0)
End Sub
or
CODE
Private Sub CheckingFiles_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim opentaskID As Double
Dim missingfiles As String
Dim i As String
Dim filename(5) As String
Dim label(5) As String
Dim path As String = Directory.GetCurrentDirectory()
Dim Labels(5) As Label
Dim Pictures(5) As PictureBox
i = 0
filename(0) = "SAFileMgr.dll"
filename(1) = "Interop.ADODB.dll"
filename(2) = "Interop.FILEMGRLib.dll"
filename(3) = "Interop.MSDATASRC.dll"
filename(4) = "Interop.StdFormat.dll"
filename(5) = "Interop.stdole.dll"
Labels(0) = label1
Labels(1) = Label2
Labels(2) = Label3
Labels(3) = Label4
Labels(4) = Label5
Labels(5) = label6
Pictures(0) = PictureBox1
Pictures(1) = PictureBox2
Pictures(2) = PictureBox3
Pictures(3) = PictureBox4
Pictures(4) = PictureBox5
Pictures(5) = PictureBox6
Pictures(0).Visible = False
Pictures(1).Visible = False
Pictures(2).Visible = False
Pictures(3).Visible = False
Pictures(4).Visible = False
Pictures(5).Visible = False
missingfiles = ""
Do While i < 5
Labels(i).Text = filename(i)
If File.Exists(path + "\" + filename(i)) = False Then
Dim yesno As Image = Image.FromFile(path + "\x.png")
Pictures(i).Image = yesno
Pictures(i).SizeMode = PictureBoxSizeMode.StretchImage
Pictures(i).Refresh()
Pictures(i).Visible = True
missingfiles = missingfiles + filename(i) + Chr(13)
'MsgBox(filename(i) + Chr(13) + "This File Needs To Be In:" + Chr(13) + path, MsgBoxStyle.Critical, "File Not Found")
' Application.Exit()
Else
Dim yesno As Image = Image.FromFile(path + "\tick.png")
Pictures(i).Image = yesno
Pictures(i).SizeMode = PictureBoxSizeMode.StretchImage
Pictures(i).Refresh()
Pictures(i).Visible = True
End If
i = i + 1
Loop
If missingfiles = "" Then
opentaskID = Shell("cmd /C regsvr32 SAFileMgr.dll /s", 0)
Else
MsgBox(missingfiles + "File(s) Needs To Be In:" + Chr(13) + path, MsgBoxStyle.Critical, "File Not Found")
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Close()
End Sub
End Class
Related :
Trik wood work tool
Using radio button vb2008
Valentineday
vb2008 with control
vb2008 with control properties
vb2008 with oriented programming
VB.NET Solution files
VB.NET Code myclass
Virus protection
VisualStudio aGood Partnership
Windows explorer vb2005
Writing first vb2008
Writing the Code vb2008
Explorer in vb2008
SQLserver2005 security
Jumat, 06 Februari 2009
Langganan:
Postingan (Atom)