473,586 Members | 2,639 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Listbox Positioning

I want a listbox to position to a letter provided by the user.
Normally, when the user keys a letter, the listbox positions
automatically to the first entry starting with that letter in the
first column.

I want to allow the user to select the column to be searched.

For eaxample, assume a list box that looks like this:

_______________ _____________
| Title | Author |
|----------|----------------|
| Oklahoma | Hammerstein, O |
| Hamlet | Shakespeare, W |
Nov 12 '05 #1
3 2487
DFS
Mike,

No can do, using the default listbox behavior. Focus will always move to
the matching value in the 1st column.

You might be able to code something in the KeyPress event to move to the
entry in the 2nd column (I've never tried it).

Or you could create a combo box that lets the user choose from a predefined
list of sorting options, and update the listbox rowsource with a new
rowsource, ie:

control: comboBox
columns: 1
RowsourceType: ValueList
RowSource: Title then Author; Author then Title; Year then Title then Author

In the AfterUpdate event of the combobox, add code like this:

if me.comboBox = "Title then Author" then me.listBox.Rows ource = "SELECT
Title, Author FROM Tables ORDER BY Title, Author;"

elseif me.comboBox = "Author then Title" then me.listBox.Rows ource = "SELECT
Author, Title FROM Tables ORDER BY Author, Title;"

elseif me.comboBox = "Year then Title then Author" then me.listBox.Rows ource
= "SELECT PublicationYear , Title, Author FROM Tables ORDER BY
PublicationYear , Title, Author;"
endif

You'll have to futz around with column counts, widths, etc.

In the end, you'll probably be better off creating separate combo or list
boxes for each field you want to search.

"Mike Top" <mi******@roger s.com> wrote in message
news:ec******** *************** ***@posting.goo gle.com...
I want a listbox to position to a letter provided by the user.
Normally, when the user keys a letter, the listbox positions
automatically to the first entry starting with that letter in the
first column.

I want to allow the user to select the column to be searched.

For eaxample, assume a list box that looks like this:

_______________ _____________
| Title | Author |
|----------|----------------|
| Oklahoma | Hammerstein, O |
| Hamlet | Shakespeare, W |
.
.

Now, assume the listbox is sorted on the second column (Author), but
the column sequence stays as is. If the user keys a "S", I want the
list to position on the second entry.

Nov 12 '05 #2
On 5 Jan 2004 19:39:11 -0800, mi******@rogers .com (Mike Top) wrote:

You "position a listbox" by setting the Value property.
I did this test by creating a new form in the Northwind sample
application. I set the Rowsource to:
SELECT [Employees].[EmployeeID], [Employees].[FirstName],
[Employees].[LastName] FROM Employees ORDER BY [LastName];
and the ColumnWidths to:
0";1";1"
Then it's just a matter of finding out which value to select:
Private Sub List0_KeyDown(K eyCode As Integer, Shift As Integer)
List0.Value = DLookup("Employ eeID", "Employees" , "LastName LIKE '"
& Chr$(KeyCode) & "*'")
KeyCode = 0 ' Cancel the event (otherwise a FirstName would be
selected)
End Sub

Note that it would have been better if in the KeyDown event I had used
the exact same sql statement as RowSource is using. I leave that for
you to implement.

-Tom.
I want a listbox to position to a letter provided by the user.
Normally, when the user keys a letter, the listbox positions
automaticall y to the first entry starting with that letter in the
first column.

I want to allow the user to select the column to be searched.

For eaxample, assume a list box that looks like this:

______________ ______________
| Title | Author |
|----------|----------------|
| Oklahoma | Hammerstein, O |
| Hamlet | Shakespeare, W |
.
.

Now, assume the listbox is sorted on the second column (Author), but
the column sequence stays as is. If the user keys a "S", I want the
list to position on the second entry.


Nov 12 '05 #3
Hi, Mike:

You can add an option box with radio buttons, the options being sort by title
or sort by author; then the afterupdate of the option box changes the rowsource
of the listbox. Pretty simple to execute and gives the user the option to
search on either field.

HTH

Jan
I want a listbox to position to a letter provided by the user.
Normally, when the user keys a letter, the listbox positions
automaticall y to the first entry starting with that letter in the
first column.

I want to allow the user to select the column to be searched.

For eaxample, assume a list box that looks like this:

______________ ______________
| Title | Author |
|----------|----------------|
| Oklahoma | Hammerstein, O |
| Hamlet | Shakespeare, W |
.
.

Now, assume the listbox is sorted on the second column (Author), but
the column sequence stays as is. If the user keys a "S", I want the
list to position on the second entry.


Jan Stempel
Stempel Consulting
Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
32043
by: Bryan R. Meyer | last post by:
Hello Everyone, The problem of browser resizing has become an issue for me. While redesigning my webpage, I set the left and right margins to be auto so that my content would be centered. However, there are images that I used absolute positioning in order to place them in the appropriate location on my page. When I do a browser resize,...
4
2696
by: Jane Withnolastname | last post by:
I am trying to re-work an old site by replacing the html with css. On the main page, I have a logo image which I needed centred on the initial screen. I found the solution here: http://www.wpdfd.com/editorial/wpd0103.htm#toptip (the second example) The problem is, under the image is a large table. But using the above positioning, now the...
14
2466
by: Harlan Messinger | last post by:
What am I not understanding about the definition of { position: absolute; }? "The box's position (and possibly size) is specified with the 'left', 'right', 'top', and 'bottom' properties. These properties specify offsets with respect to the box's containing block." Please take a look at http://gavelcade.com/abspos.html and help me...
6
2672
by: rajek | last post by:
I posted a similar question yesterday, but didn't get an answer that resolved the issue. (Thanks to those who tried though.) The background: I've read in books and online that if you have one element with "relative" positioning, such as a <div>, it creates a "positioning context" for element within it. E.g., if you have a <p> inside your...
11
2628
by: NS | last post by:
I am relativly new to css positioning and have a question regarding the display of a DHTML pop-up Here is the basic HTML I am using: <html> <head> <script language="JavaScript"> <!--
17
3100
by: amber | last post by:
Hello. Can someone tell me what I may be doing wrong here? I'm using the code (lboxRP is a listbox): Dim newRPindex As Integer newRPindex = Me.lboxRP.FindString(RP) Me.lboxRP.SetSelected(newRPindex, True) When the last line executes, I get an error message:
1
2797
by: Charles Harrison Caudill | last post by:
with tables there is a clean and algorithmic way to organize things, but with css which is, once you get it working, much cleaner, I have to tweak and patch and hope and pray and curse before things are positioned the way I want them. It *should* be easy to say: this goes on the left, this goes on the right, this goes in the center, all on...
6
2865
by: Chris Leuty | last post by:
I am populating a multiselect Listbox from a dataset, with the content of the listbox filled by one table, and the selections determined from another table. So far, I have been keeping the dataset a denormalized mirror of the database, but I'm not having much luck getting the selection logic down (I haven't found a 'hook' where I can access...
6
2908
by: Mark | last post by:
hi, i'm trying to position something in the top right corner of a container, but i can't seem to figure out how to get it working. here's the html <div class='thumb'><a href='image.jpg'><img src='photos/thumbs/ bigsmile.jpg'></a><a class='del' href='?p=gallery&del=2'>x</a></div> where 'thumb' is my container, and 'del' should be aligned...
0
7839
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8216
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5710
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5390
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3837
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3865
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2345
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 we have to send another system
1
1449
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.