473,411 Members | 2,014 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

Listbox not taking next items.(VB2005)

In my previous topic ( http://www.thescripts.com/forum/thread678765.html )
I thought I finally had the code to work, and it did work, till I added a few other lines of code and then it stopped taking the next items from the listbox. It just writes the first one, and keeps repeating it every minute.

The code "danp129" posted in there worked perfect in VB6, but now I have VB2005 Express Edition.

I managed to change the code so it would work a bit, but not much result.

Expand|Select|Wrap|Line Numbers
  1.     Private Sub msgtimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles msgtimer.Tick
  2.         Dim msg As Long
  3.         If msg = msglist.Items.Count - 1 Then msg = -1
  4.         msg = msg + 1
  5.         SendKeys.Send(msglist.Items(msg))
  6.         Wait(100)
  7.         SendKeys.Send("{ENTER}")
  8.     End Sub
  9.  
Basically what it does, or suposes to do is take the first item from the listbox, write it and press Enter. Then I want it to take the second and press Enter, but it refuses and repeats the first one.
I think this is the problem:
msg = msg + 1
Somehow this should loop it after the interval so it will write the other items aswell.
Could someone tell me how it's done ?
Also, does it start with the first item again after it's had the last one ?

Thanks and Regards,
Evolution445
Jul 23 '07 #1
2 1059
Killer42
8,435 Expert 8TB
I believe you need to make your "msg" variable static. As it stands, it is being recreated with a value of 0 each time, and it looks as though you want it to retain its value between ticks.
Jul 24 '07 #2
Thanks again, now it's working as it should :)
Jul 24 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: tangokilo | last post by:
Hello and thanks for your help, I have the following Listbox created in VisualStudio 2003 designer, desiring to select multiple entries from that list: -------------------------------...
18
by: Dave Sauny | last post by:
Ok, its a friday, I'm at work and I cant get this to work: I have 3 listboxes on one tab control page. when i select an item in listbox1 i want whatever is selected on the other 2 listboxes...
28
by: cjobes | last post by:
Hi all, I need to populate a listbox from a table column. The column has multiple entries of usernames and I need to pull a unique set of usernames. The table is part of an untyped Dataset that...
2
by: Tom McL. | last post by:
I would like to align text in a ListBox to achieve columns. In the past I could determine the text width in Twips and pad in required number of blank spaces. But now I'm using VB2005 and it...
3
by: Ali Chambers | last post by:
Hi, I have created a listbox called "dtlist1" on my VB.NET form. I call a procedure as follows: Private Sub openfile(flname As String) dtlist1.Items.Clear() etc..
2
by: rn5a | last post by:
A ListBox lists all the files & directories existing in a directory on the server. If an item in the ListBox happens to be a directory, then the name of the directory is appended with the text ....
4
by: rn5a | last post by:
Can the items in a ListBox be sorted by the name of the items? The ListBox actually lists all directories & files existing in a directory on the server. Note that all the directories should be...
1
by: Sunray | last post by:
I have a form called the sales form and i have 2 sets of listboxes So what happens is. i add items form the bottom set of list boxes which are bound to a data base to the top set of list boxes which...
1
by: jasydnor | last post by:
Hi, New to the forums and have a question. I've only been developing for about five months now so I apologize if this seems oversimplistic....I am writing a program on an idea I had on a whim. ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.