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

List Box

I have six list boxes in my VB6 project and two buttons.

The first button's job is to select the next item in the current list box. Now that I am adding more listboxes how can I modify the following command so that it will always pertain to the current list box?

If List1.ListIndex > 0 Then
List1.ListIndex = List1.ListIndex - 1
End If

Also how can I create a way so that when the second button is pressed the first value in the next list box is chosen?

Thanks!
Mar 16 '08 #1
5 905
debasisdas
8,127 Expert 4TB
If you want to select the next item it must be +1 not -1.
Mar 17 '08 #2
QVeen72
1,445 Expert 1GB
Hi,

When you Select a ListBox, and Then Click on the Command button, your Focus should have shifted to the Command, you will not get Previously selected List Box. To find the last selected Control , you have to Declare a Formlevel variable say:

Dim intL as Integer

And in GotFocus of all the ListBoxes, populate that Variable with some Number (say 1 for list1, 2-for list2 and so on..)
and in command Click use a select case and set that ListBox's ListIndex to next Index..

REgards
Veena
Mar 17 '08 #3
Killer42
8,435 Expert 8TB
Just one thing - since you're using VB6, I'd recommend using a control array for the listboxes. It makes your code much simpler, since you just change the index to refer to different controls, rather than having to write code for each one.
Mar 17 '08 #4
Thanks guys.

I have heard of arrays and have been reading on them since my post.

So if I make an array, I have to declare the array? Then I can type code with your recommendations to shift through the list boxes once the command is pressed?

What does it mean to type a select case?

Thanks again.
Mar 18 '08 #5
Killer42
8,435 Expert 8TB
I have heard of arrays and have been reading on them since my post.

So if I make an array, I have to declare the array? Then I can type code with your recommendations to shift through the list boxes once the command is pressed?
You don't declare a control array like you do an array of variables. In the form designer, just copy a control, then paste it back in. VB will ask if you want to make them an array.

What does it mean to type a select case?
Not sure what you're asking.
Mar 18 '08 #6

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

Similar topics

6
by: massimo | last post by:
Hey, I wrote this program which should take the numbers entered and sort them out. It doesnąt matter what order, if decreasing or increasing. I guess I'm confused in the sorting part. Anyone...
10
by: Kent | last post by:
Hi! I want to store data (of enemys in a game) as a linked list, each node will look something like the following: struct node { double x,y; // x and y position coordinates struct enemy...
24
by: Robin Cole | last post by:
I'd like a code review if anyone has the time. The code implements a basic skip list library for generic use. I use the following header for debug macros: /* public.h - Public declarations and...
4
by: JS | last post by:
I have a file called test.c. There I create a pointer to a pcb struct: struct pcb {   void *(*start_routine) (void *);   void *arg;   jmp_buf state;   int    stack; }; ...
3
by: chellappa | last post by:
hi this simple sorting , but it not running...please correect error for sorting using pointer or linked list sorting , i did value sorting in linkedlist please correct error #include<stdio.h>...
0
by: drewy2k12 | last post by:
Heres the story, I have to create a doubly linked list for class, and i have no clue on how to do it, i can barely create a single linked list. It has to have both a head and a tail pointer, and...
10
by: AZRebelCowgirl73 | last post by:
This is what I have so far: My program! import java.util.*; import java.lang.*; import java.io.*; import ch06.lists.*; public class UIandDB {
0
by: Atos | last post by:
SINGLE-LINKED LIST Let's start with the simplest kind of linked list : the single-linked list which only has one link per node. That node except from the data it contains, which might be...
12
by: kalyan | last post by:
Hi, I am using Linux + SysV Shared memory (sorry, but my question is all about offset + pointers and not about linux/IPC) and hence use offset's instead on pointers to store the linked list in...
7
by: QiongZ | last post by:
Hi, I just recently started studying C++ and basically copied an example in the textbook into VS2008, but it doesn't compile. I tried to modify the code by eliminating all the templates then it...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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...

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.