473,756 Members | 8,108 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

need help: list box showing item selected when none are

I have a list box bound to a data set, of course the datasource,data member,
and valuemember are set, i tell it selecteditem = -1 to make nothing
selected, select mode is set to only one item at a time. When the list fills
the first item in the listbox has a background rectangle drawn but no focus
rectangle (this is NOT a custom drawn listbox, just a standard one).. now i
did set -1 as the selected item, but if i tab to the item the focus
rectangle is now showing over the background rectangle on the 1st item, then
when i tab off the listbox now nothing is selected like it should of been to
start with... what would cause this?! thanks.. the listbox is in a custom
control which is then placed onto a form... if i do it only on a form by
itself it works fine... but when its in a custom control it causes this
problem..
Nov 20 '05 #1
7 1479
test app web link incase someone has filteres up to block attachments
http://www.bhplace.com/testapp.zip
"Brian Henry" <br******@adelp hia.net> wrote in message
news:el******** ******@TK2MSFTN GP11.phx.gbl...
I have a list box bound to a data set, of course the datasource,data member, and valuemember are set, i tell it selecteditem = -1 to make nothing
selected, select mode is set to only one item at a time. When the list fills the first item in the listbox has a background rectangle drawn but no focus rectangle (this is NOT a custom drawn listbox, just a standard one).. now i did set -1 as the selected item, but if i tab to the item the focus
rectangle is now showing over the background rectangle on the 1st item, then when i tab off the listbox now nothing is selected like it should of been to start with... what would cause this?! thanks.. the listbox is in a custom
control which is then placed onto a form... if i do it only on a form by
itself it works fine... but when its in a custom control it causes this
problem..

Nov 20 '05 #2
Cor
Hi Brian,

Use the selectedindex

I hope this helps?

Cor
Nov 20 '05 #3
same result with selected index.... just switch it in the test project i
posted and see :\
"Cor" <no*@non.com> wrote in message
news:eN******** ******@TK2MSFTN GP12.phx.gbl...
Hi Brian,

Use the selectedindex

I hope this helps?

Cor

Nov 20 '05 #4
Cor
Hi Brian,

I thought in your message that you did mean that little listbox bellow, but
you did mean the listbox in the usercontrol.

You have bound that listbox in the usercontrol to that dataclass USState

And in your form you are filing that dataclass

And therefore the selectedindex is affected.

After filing of that dataclass you can set the usercontrol selectedindex

UserControl11.L istBox1.Selecte dIndex = -1

You will see that it is deselected.

I hope this helps?

Cor
Nov 20 '05 #5
how about when the user control is in a ClassLibary and being refrenced
though that DLL into the form in the application... then i cant do the
usercontrol1.li stbox1.selected index = -1 because i then no longer have the
contorls inside the user control available to me.... thats my problem at
this point...
"Cor" <no*@non.com> wrote in message
news:uv******** ******@TK2MSFTN GP09.phx.gbl...
Hi Brian,

I thought in your message that you did mean that little listbox bellow, but you did mean the listbox in the usercontrol.

You have bound that listbox in the usercontrol to that dataclass USState

And in your form you are filing that dataclass

And therefore the selectedindex is affected.

After filing of that dataclass you can set the usercontrol selectedindex

UserControl11.L istBox1.Selecte dIndex = -1

You will see that it is deselected.

I hope this helps?

Cor

Nov 20 '05 #6
Cor
Hi Brian,

Do you mean that you want something like this in your usercontrol?

Private Sub ListBox1_Bindin gContextChanged (ByVal _
sender As Object, ByVal e As System.EventArg s) _
Handles ListBox1.Bindin gContextChanged
ListBox1.Select edIndex = -1
End Sub

Cor
Nov 20 '05 #7
thank you so much!!! thats exactly what i was looking for

"Cor" <no*@non.com> wrote in message
news:eW******** ******@TK2MSFTN GP12.phx.gbl...
Hi Brian,

Do you mean that you want something like this in your usercontrol?

Private Sub ListBox1_Bindin gContextChanged (ByVal _
sender As Object, ByVal e As System.EventArg s) _
Handles ListBox1.Bindin gContextChanged
ListBox1.Select edIndex = -1
End Sub

Cor

Nov 20 '05 #8

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

Similar topics

5
1549
by: mt | last post by:
In a nutshell, I'd like to have a list of items, each of which fills out a small table which displays some info about a particular item(the items being a trouble ticket for a tech support ASP-built web-based app). There may be zero, one, or many of these per ticket. Since some tickets have many of these items (call them work items), the page can get awful long. I have this part working already. So my proposed solution to make the pages...
3
3615
by: Paul T. Rong | last post by:
I have a listbox (of product names) control on my form. I want to pass the selected item (a product name) to a subform, and the product unitprice should apear automatically next to the product name in the subform. Is it possible? How do I do this? Thanks in advance. Paul from Slovakia
2
1173
by: student | last post by:
Hi all, I'm having trouble with my datagrid, it is suppose to display a row from a table called "Calls" based on what is selected in the dropdownlist which displays the first and last name from another table called "Contacts". The problem is only the dropdownlist is showing in the browser and nothing from the datagrid shows. Could someone please point out my error, I am new at this, and would appreciate some help. thanks, student Here's...
10
10768
by: dhnriverside | last post by:
Hi guys Still having a problem with this dropdownlist. Basically, I've got 4. The first 2 work fine, then my code crashes on the 3rd. ddlEndTimeHour.Items.FindByValue(endTime).Selected = true; Where endTime is a string containing "15".
3
1304
by: Larry | last post by:
I've set up a list of image filesnames in a listview control(lvSrcFileList), I'm using the selectedIndexChange event to select which file is being displayed in a picturebox control(pbImagePreview). The first time a filename is selected it works fine but if I try to select another filename the program bombs with an exception error; flagging the line below "curntImage = Image.FromFile(cpath). The listview is set for a single selection....
1
4953
by: Bob | last post by:
Hi, Hope you can help me with this one. I'm at my wits end. I'm trying to create an intelligent edit-box like the excellent "Customer" one at the URL: http://munich.schwarz-interactive.de/autocomplete.aspx
3
1556
by: Strasser | last post by:
In a nested subform in datasheet view, an interviewer of homeless people picks a descriptive CATEGORY from 20 descriptive categories. The 20 categories are displayed via a combo box. (Categories are things like "addiction", "criminal", "dangerous?" etc. Total number of categories = 20). For EACH of the 20 categories there are 5 statuses, from "bad" (1=worst) to "good" (5=best). (Therefore, there are really 100 choices: 20 categories...
0
1526
by: Geary | last post by:
I have a drop down list on an asp.net 2 page that is bound to a table. By default it displays the first item as the selected item. But I want to make sure that the user must change the selection. I am using the change-selection event to trigger so other code. If the user is satisfied with the default this other code won't run. So I am adding an additional .item.add("(None)") after the .databind() to add a (None) selection to the list....
1
2166
by: ollielaroo | last post by:
Hi guys, Firstly I did do a search for this one first but I couldn't find anything related in this forum. I am using Dreamweaver MX and trying to build admin pages for an ASP site. My problem is I have Categories and various Products in each Category. I'm trying to build a page to EDIT/UPDATE each product.I want to be able to change the Category that a product belongs to, but all I get in the drop-down menu is the one specific Category. ...
0
9456
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9275
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10040
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9873
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9713
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8713
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7248
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
2
3359
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2666
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.