473,699 Members | 3,360 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ListBox On Click Event

14 New Member
Hi all

I wrote a listbox onclick event.On a click i want to get the selected row details but the listbox.selecte d(i) always returns false ,it returns true only in
double click event.Are they any other events on which i could do this.I want to populate a textbox based on the row selected from the listbox.Its working as i want when i add the code in a double click event but it doesn't make much sense doing it on a double click event.

thanks
Sree
Jan 26 '09 #1
5 23890
missinglinq
3,532 Recognized Expert Specialist
The standard method for doing this sort of thing uses the AfterUpdate event of the listbox (or combobox) not the Click or DoubleClick event.

Welcome to Bytes!

Linq ;0)>
Jan 26 '09 #2
buddydasari
14 New Member
missinglinq

I tried that too.Didn't work either.the listbox.selecte d returns false in any event except in double click evnt.

thanks
Sree
Jan 26 '09 #3
missinglinq
3,532 Recognized Expert Specialist
This type of thing is normally done without using the Selected property at all, something like this.

Expand|Select|Wrap|Line Numbers
  1. Private Sub YourListBoxName_AfterUpdate()
  2.      Me.TextBox1 = Me.YourListBoxName.Column(0)
  3.      Me.TextBox2 = Me.YourListBoxName.Column(1)
  4.      Me.TextBox3 = Me.YourListBoxName.Column(2)
  5. End Sub
Note that the columns are Zero-based, so the first column (reading left-to-right) would be column(0), the second column(1) and so forth.

When you click on a row to select it the textboxes are filled in.

Linq ;0)>
Jan 26 '09 #4
buddydasari
14 New Member
All

Got it worked using listbox.listInd ex property instead of listbox.Selecte d property on OnClick event


thanks for ur help
Sree
Jan 26 '09 #5
missinglinq
3,532 Recognized Expert Specialist
Glad you got it working. The Selected Property is intended to be used when the Listbox Multi-Select Property is set to either Simple or Extended. You use it to loop thru all rows to see which are selected. It's really not meant to be used in your type of application.


Linq ;0)>
Jan 26 '09 #6

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

Similar topics

0
1430
by: CoreyMas | last post by:
Hello everyone Is there a way to create a double click event on a listbox control in VB.net without having to resort to Javascript? Thanks in advance Corey
1
1303
by: Daniel G | last post by:
Hello , In an ASP.Net page, there are some DropDownLists used for adding some conditions to a Select statement, a button (server-side, too). And in the same page there is a ListBox that must be filled by Click event handler of my button. Everything is ok, but ... it is something very strange with the ListBox (autopostback = true)
5
1849
by: PAPutzback | last post by:
Form2 has one purpose to open and list some names and ids. I want to handle the list box click event on form2 so I can get the selected value onto a field in form1. I changed this Dim MyForm2 As New PHfx.Form2 to With Events MyForm2 As New PHfx.Form2 and tried adding an event handler but intellisense will not show form2s objects, just the methods.
1
1884
by: tony | last post by:
Hello! If you drag a ListBox into a windowform and then right click on this ListBox and then chose property. When you have the properties up click on the flash symbol for seeing all the events for this ListBox. The property page where you can see all the events I call property event page.
1
7056
by: superjacent | last post by:
Hope someone can point me in the right direction. When opening a form the 'click' event of the ListBox is invoked (run). I thought the 'click' event of the ListBox is only invoked when clicking it. I've looked all over the preceeding and other events on the form and definitely do not invoke the ListBox 'Click' event. What does happen during form initialisation or setup (load) is that the rowsource, columnwidths, columncount etc are...
4
4749
by: Jeff User | last post by:
Hi Using .NET 1.1, C#, web app I (actually our client) would like to be able to double click a selection in a listbox and have it postback to server . There I would want to access the item that was double clicked. Any idea how to go about this? Thanks
10
6791
by: buddydasari | last post by:
Hi all Is there any event for list box row click/double click.I want to open a new form based on the row selected and when it is clicked.I know there's one for the whole list box but i am looking for a row click event.I want to know if there is such an event or any other way to implement this. thanks Sree
7
4305
by: onyris | last post by:
Hi guys, have a form which displays all the records i have in my database , and a search box for the user to search for a specific one . On the search button, i run a macro which opens another form with only the records found based on the search. So far so good On the second form, first record found is displayed ( customer and deatils) and u can navigate through the rest . But i also have a listbox which holds only a field ( first_name...
2
7709
by: svibuk | last post by:
i have a asp.net list box populated with databae data , autopostback = true wht i need is 1) when double clicked(double click event) i want it to be visible=false 2)i want to move between the data in the listbox using up, down arrow keys & make the selection by pressing eneter(keypress event) 3) everytime i move betwen the data(autopostback = true) postback is caused,is it possible to avoid the flickering without ajax as if i have to...
0
8704
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
9187
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
8894
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
7776
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
6540
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...
0
5879
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4390
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2015
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.