[RESOLVED] File name generator
Hi, im working for a school project and im trying to make a screenshot tool
so i made it very simple with the following code below
Code:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Dim ScreenSize As Size = New Size(My.Computer.Screen.Bounds.Width, My.Computer.Screen.Bounds.Height)
Dim screenGrab As New Bitmap(My.Computer.Screen.Bounds.Width, My.Computer.Screen.Bounds.Height)
Dim g As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(screenGrab)
g.CopyFromScreen(New Point(0, 0), New Point(0, 0), ScreenSize)
screenGrab.Save("C:\Screen.jpeg")
MsgBox("Screenshot has been succesfully made!", MsgBoxStyle.Information, "Screenshot Success!")
Catch ex As Exception
MsgBox("Error", MsgBoxStyle.Critical, "Error!")
End Try
End Sub
End Class
so as you can see in my form only exists one button that takes the screenshot and then saves it in C:\ directory with the name SCREEN.JPEG
but here's the problem i want to make it whenever i click the BUTTON to take the screeshot to generate a new name for the new screenshot (e.g. screen2.jpeg and so on and on...). I just want to not overwrite the first screenshot but to generate another name for the second screenshot.
I'm sorry for my bad english...
i would appreciate your help
p.s
i forgot to mention, I'm using Visual Basic 2008 Express Edition