473,425 Members | 1,771 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,425 software developers and data experts.

Reading values from a listbox (VB6)

1
I am new to VB and already have codes from a database that populates a list box. But my problem is that I do not know how I can read these values from the list box automatically. I basically want a background colour to change to green when 1 is read from the ListBox and red when 3 is read.

I tried the codes posted previously on "read and write from a list box" but they only read the 1s and moved back to the beginning without reading the 3s.
I will like also like a progress bar to increment each time the 3 is encountered.

Expand|Select|Wrap|Line Numbers
  1. Private Sub msgtimer_Timer()
  2. Dim msgItem As Long
  3.  
  4.     'Timer to send keystrokes
  5.     If msgItem = lstAlert.ListCount - 1 Then msgItem = -1
  6.     msgItem = msgItem + 1
  7.     SendKeys lstAlert.List(msgItem), 10
  8.  
  9.     If msgItem = "3" Then
  10.         Picture9.BackColor = &HFF&
  11.         prgBar = prgBar + 5
  12.     Else
  13.         If msgItem = "1" Then
  14.             Picture9.BackColor = &HC000&
  15.         End If
  16.     End If
  17. End Sub
  18.  
  19. Private Sub cmdGo_Click()
  20.     msgtimer.Enabled = True
  21. End Sub
I will really appreciate any help. Thank you!
Aug 23 '07 #1
0 1391

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

Similar topics

2
by: Bill Dudek | last post by:
Does vb.net have a listbox with a checkbox style like in vb6? I didn't even see a style option under properties. I'm just starting in .net and am trying to port an existing application over. ...
3
by: R. de Vos | last post by:
Hi all you experts, I have a 'small' problem In a mdb I have a column called "PLACE" its value type = text rowsourcetype=list with values Rowsource = HOME;SCHOOL;STATION What I would like...
7
by: Dave Hopper | last post by:
Hi I posted a question recently regarding problems I am having getting a value from a list box to use in a query. I got a lot of help, for which I thank you and it's nearly working! But I need...
6
by: Janaka | last post by:
Help! I have two ListBox controls on my web form. The first one gets populated on entry with values from the DB. I then use JavaScript to copy options from this ListBox to my second one. (I...
3
by: BVH | last post by:
Hi, I'm currently having a problem with a vb6 project I once wrote that needs to be converted to vb.NET. The problem is as follows : On a form I have a listbox and two commandbuttons. The 2...
4
by: CR | last post by:
In VB6 if I wanted to display a group of records, and possibly allow the user to select one or more records, I would use the ListBox. For example suppose I wanted to display something like this: ...
0
by: Dave | last post by:
Hi all, I have a listbox that is complex bound by an arraylist. The problem is that when I delete an object from the arraylist, the listbox does not reflect those changes. I tried refreshing...
0
by: bastet | last post by:
Hello, I'm developing an application that nedds to read the objects of a Powerpoint slide and keep the values in a Database. I found all the information about text shapes, but I need to read the...
6
by: Pippen | last post by:
Hi, I'm trying to read all the selected items in a ListBox. So after the user selects the values they want in the ListBox they select a button. This is where I want to put into a string all the...
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...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
1
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...

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.