473,503 Members | 10,012 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Reading values from a listbox (VB6)

1 New Member
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 1392

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

Similar topics

2
8880
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
1964
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
2571
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
5177
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
2178
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
2690
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
1675
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
952
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
4139
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
4009
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
7194
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
6976
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
7449
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
5566
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,...
1
4993
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...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3148
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1495
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
729
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.