|
Hi,
1) You load all images into an array (16 not 15 by the way).
2) When the timer event occurs you should load one image into the PictureBox.
What is your timer event handler doing?
Alan.
|
|
|
|
|
Hello
Thanks for your answer
you mean some thing like ths
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
For Me.I = 0 To 15
PictureBox1.Image = (MyImage(I))
Next I
End Sub
if yes then i have tried but still the same i know there is very small mistake but i am not getting there
|
|
|
|
|
Hi,
Every time the timer event fires you want to display a different image, correct?
Within your handler you have written a loop that loads all of the images every time it is called, hence you only ever see the last one, MyImage(15).
The code should select one index, i.e. one of the values 0 to 15, and then load the image referenced by the index into the picture box.
Alan.
|
|
|
|
|
Look at LoadImages. Assuming that you want the sequence to go in the order G1, G2, G3, G4, etc., you're setting the array in the wrong order. You load G10 before G2, and so on
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
hello
thanks for your rep.
no the order in array is right order so all the images should display as per array order what i what to do is when i start app it should display images until i close the app. i mean first image in array and then 2nd and 3rd up to 16th and then 1st image again but now it's load all the images and display only 16th image in to the picture box i want it keep displaying images from first image in array to last image in array and then go back to first image and so on
waiting for your kind help
|
|
|
|
|
Something like this?
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Private Shared nextImage As Integer = 0
PictureBox1.Image = MyImage(nextImage)
nextImage = (nextImage + 1) Mod 16
End Sub
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
|
|
|
|
|
Unless I have misread your code, it would not work! Every time the tick event fires you are setting nextImage to 0, before doing anything else, therefore the last line of your snippet is useless.
The OP should use something like this:
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
PictureBox1.Image = MyImage(Me.I)
Me.I = (Me.I + 1) Mod 16
End Sub
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
nextImage is static (i.e. Shared in VB) so it is set to 0 only on first call to Timer1_Tick. It retains its value between successive calls which is what I think the OP requires.
The problem with Me.I is it could be changed outside of the handler by some unrelated code. When the handler is called you have no idea what the value of Me.I is so it's wide open to index out of bounds exception.
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
|
|
|
|
|
OK. Sorry I missed that.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Easily done - often guilty of it myself.
When I thought about the bounds it struck me that this is better.
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Private Shared nextImage As Integer = 0
PictureBox1.Image = MyImage(nextImage)
nextImage = (nextImage + 1) Mod MyImage.Length
End Sub
Then you don't have to do anything if more images are added or some removed.
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
|
|
|
|
|
hello
thanks for your rep.
yes it's works fine
this is what i changed
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
'PictureBox1.Image = (MyImage(I))
Static nextImage As Integer = 0
PictureBox1.Image = MyImage(nextImage)
nextImage = (nextImage + 1) Mod MyImage.Length
End Sub
it's working as i was trying to
thanks a lot sir
have a nice day
|
|
|
|
|
riced wrote: Then you don't have to do anything if more images are added or some removed.
Good point.
I really should practice VB.Net more, if I want to play over here.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi, I think this is the right place to post,
I've coded quite a bit in VB Net so far, not very advanced stuff though, and I'd like to learn more.
What I'd really like to do is create application that communicate over LAN, and to start of with something basic.
Like I click a button on one PC and in a texture on the other PC it says something like hello.
I've tried searhcing the internet, and I have no idea where to start. So I'm hoping someone here can help.
Evenutally I'd like to get a webpage that when you click a button on that it sends something (like 'hello') to a VB app.
Then get a VB app to talk to a Picaxe microcontroller, (I have already created an electronic dice using Picaxe and Basic(not VB))
I have created a website with the basics of html and php, and can do a little Javascript.
Then be able to send something(again like 'hello') from a webpage to a microcontroller (though VB or not).
I'm willing to learn, and this is something I'd really like to do, so please don't just discard this topic as another person just wanting code and not doing anything for it.
Thanks,
Jonathan
|
|
|
|
|
Unluckily, there is no easy and straight answer to what you ask. Inter-process commuications can be done in many different ways, all of which have their pros and cons, and all of which require study. Sending data from a "webpage" to an application can be even more complicated.
My best suggestion is you start having a Google at inter-process communications or tcp communications with VB.NET, and that might get you started for your first issue.
For the second issue, you need something more complicated, like SOAP or similar. If your website and the application reside on the same machine, then you might make it simpler by thinking about some kind of "local" inter-process communication between your server-side code (php or whatever) and the application.
I know I'm not of much help here, but it's really a wide subject we're talking about.
2+2=5 for very large amounts of 2
(always loved that one hehe!)
|
|
|
|
|
I believe the topic (technology) you are looking for would be considered a webservice. Do a search here in CodeProject and you should find something.
Maybe this article will help: (it is written in C#, but you should be able to get the idea)
How to make a simple WebService and consume it.[^]
|
|
|
|
|
Thanks I found it relatively easy actaully, though I understand the code, I'm having a bit of trouble.
I got a VB app to send text to another VB app on a different PC then got a website (On my local network) to send text to the VB app (using TCP/sockets or whatever).
This is the code I have atm in the VB app:
Sub Main()
' Must listen on correct port- must be same as port client wants to connect on.
Const portNumber As Integer = 8000
Dim tcpListener As New TcpListener(portNumber)
tcpListener.Start()
Console.WriteLine("Waiting for connection...")
Try
'Accept the pending client connection and return
'a TcpClient initialized for communication.
Dim tcpClient As TcpClient = tcpListener.AcceptTcpClient()
Console.WriteLine("Connection accepted.")
' Get the stream
Dim networkStream As NetworkStream = tcpClient.GetStream()
' Read the stream into a byte array
Dim bytes(tcpClient.ReceiveBufferSize) As Byte
networkStream.Read(bytes, 0, CInt(tcpClient.ReceiveBufferSize))
' Return the data received from the client to the console.
Dim clientdata As String = Encoding.ASCII.GetString(bytes)
TextBox1.Text = clientdata
'Any communication with the remote client using the TcpClient can go here.
'Close TcpListener and TcpClient.
tcpClient.Close()
tcpListener.Stop()
Console.WriteLine("exit")
Console.ReadLine()
Catch e As Exception
Console.WriteLine(e.ToString())
Console.ReadLine()
End Try
That is then called when form1 loads. The problem I have is unless I have me.show() before calling the above sub, the form will not show. And when I do have me.show() the form is frozen (though it doesnt have "Not Repsonding").
Also after I have sent some text I can't send any more without restarting the app.
Some help would be greatly appreciated, I have trawled google for several issues I had with PHP and IIS so please forgive for asking straight here and not bothering with google.
Jonathan
|
|
|
|
|
Still need help here, anyone?
Jonathan
|
|
|
|
|
When you press the send program freezes and you can't do any thing
how i can add button puss resume and stop
Project here
http://www.mediafire.com/download.php?wugizujoeuy
modified on Saturday, June 6, 2009 4:04 PM
|
|
|
|
|
There's no way anyone is going to read through all of that code. You post just the relevant parts to the problem. But, from what I did read, this is a total mess. Your creating your own thread, using a background worker, async methods with synchronous methods, Buttons without a meaningful name (Button1, Button2, ...) and so on. The only place I can start with this is to scrap it and start over. I have no idea what any of this code is trying to do, other than send emails.
Start small. Try creating an app that sends a single email using synchronous methods. Then write another one using asynch methods. If you're trying to send lots of emails, trying writing an app using a background worker than just increments a counter one a second. Start small, understand the technologies you're using, then you can start putting these smaller examples together.
|
|
|
|
|
when i click button, send , progrem freez and i can't click buton stop or puss
(programme continuos sending)
I want to work with Multi-Threading and this method smtp.send (mail)
download the project to understand
modified on Saturday, June 6, 2009 4:21 PM
|
|
|
|
|
You are an idiot. Dave downloaded the project, how else would he know what variable names you used ? So, your code sucks. I would guess that you need to start slower, learn some basics before reattempting this task
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
|
|
|
|
|
Hello:
Any one know of a VB 2008 express example with source code that shows how to open a MS Access database and list all of the tables.
I'm a novice try to learn how to open view and manipulate the data in each table.
I do not wish to tie up your time with a lot of questions
Thank you
|
|
|
|
|
Why don't you start with trying to manipulate the data in a single, known table, before you get into the more advanced stuff of manipulating the system tables in a database.
|
|
|
|
|
Hi,
I'm having trouble trying to create a relation between two DataTable in my DataSet. Im getting an error saying "NullReferenceException was unhandled"
I have a DataSet call "myDataSet"
I have two tables call "ConsoleDT" and "GameDT"
The primary key in ConsoleDT is "ConsoleID" and GameDT also has a column called "ConsoleID"
Heres my code
Dim Fkey As New ForeignKeyConstraint("FKGameConsole", myDataSet.Tables("ConsoleDT").Columns("ConsoleID"), myDataSet.Tables("GameDT").Columns("ConsoleID"))
myDataSet.Tables("ConsoleDataTable").Constraints.Add(Fkey)
Thanks
|
|
|
|
|
Your code is assuming that you actually have a table called "ConsoleDT" in myDataSet. It's also assuming that that table has a column called "ConsoleID". It's also assuming that there is a table called "GameDT" and that it has a column called "ConsoleID". And so on, and so on... It would probably be a good idea to check if these things exist before you try and use them.
|
|
|
|