Hi all,
I am trying to add a banner to a simple VB.Net application.
By banner I mean that I have a folder with several jpeg files (I named them 1.jpeg,2.jpeg etc) and once the form is loaded I want them to rotate in the picturebox (or whatever tool is used) after lets say 5 or 10 second...
Could you advise how this can be done?
Many thanks.
4 Replies - 312 Views - Last Post: 26 November 2012 - 05:20 AM
#1
Need help - Creating a dynamic banner in simple VB.Net application
Posted 26 November 2012 - 02:52 AM
Replies To: Need help - Creating a dynamic banner in simple VB.Net application
#2
Re: Need help - Creating a dynamic banner in simple VB.Net application
Posted 26 November 2012 - 03:29 AM
Hi,
Try this.
Step I : Create an array of string. Place paths of your images in each variable. Say
Create another variable Count of Integer type
Step II: Create and integer variable say CaptTime.
On FromLoad event,
Step III : Drag a Timer Control on the form. And on Timer1.Tick event Add following code. Create another integer variable called ElapsedTime.
Hope this may work. The code written need not to be correct (Since I do not have visual studio currently) but idea is correct. Hope this was useful for you.
Try this.
Step I : Create an array of string. Place paths of your images in each variable. Say
Path[0]= "D:\1.jpg" Path[1]= "D:\2.jpg" Path[2]= "D:\3.jpg"
Create another variable Count of Integer type
Dim Count as Integer=0
Step II: Create and integer variable say CaptTime.
On FromLoad event,
CaptTime=DateAndTime.Now.Seconds
Step III : Drag a Timer Control on the form. And on Timer1.Tick event Add following code. Create another integer variable called ElapsedTime.
ElapsedTime=DateAndTime.Now.Seconds-CaptTime If(ElapsedTime=5) Then if Not(Count>3) Then Count= Count+1 End If Picturebox1.Image= Path[Count] CaptTime=DateAndTime.Now.Seconds
Hope this may work. The code written need not to be correct (Since I do not have visual studio currently) but idea is correct. Hope this was useful for you.
#3
Re: Need help - Creating a dynamic banner in simple VB.Net application
Posted 26 November 2012 - 04:06 AM
Thank you very much!
The syntaxis is my big problem ((
throws me an error "String cannot be converted to System.Drawing.Image"
The syntaxis is my big problem ((
Picturebox.Image= Path[Count]
throws me an error "String cannot be converted to System.Drawing.Image"
#4
Re: Need help - Creating a dynamic banner in simple VB.Net application
Posted 26 November 2012 - 04:13 AM
I used
but when I run the program,nothing happens, picturebox shows nothing
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim ElapsedTime As Integer
Dim Count As Integer = 0
Dim path(50) As String
path(0) = "C:\photos\1.jpeg"
path(1) = "C:\photos\2.jpeg"
path(2) = "C:\photos\3.jpeg"
ElapsedTime = DateAndTime.Now.Second - CaptTime
If (ElapsedTime = 5) Then
If Not (Count > 3) Then
Count = Count + 1
End If
End If
Picturebox.Image = Image.FromFile(path(Count))
CaptTime = DateAndTime.Now.Second
End Sub
but when I run the program,nothing happens, picturebox shows nothing
#5
Re: Need help - Creating a dynamic banner in simple VB.Net application
Posted 26 November 2012 - 05:20 AM
Sorry my mistake. Use, PictureBox1.ImageLocation=Path[i].ToString.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote



|