473,597 Members | 2,190 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

getting data from selected listview item

2 New Member
I am making a small adressbook like program.

I made a listview which is populated by my user data base.

I want the users to be able to select their name on the list and then press the log on button, where after a new form will appeer with their info.

now my problem is not how to open the new form nor to make variables.

the problem is how do I make the program now what person have been selected on the list?

In other words, how do I extract the data from the selected post on the viewlist, with the click of a button?

I have searched high and low for an answer to this, so it would be really great if you guys could help me :(
Mar 11 '07 #1
2 1443
kenobewan
4,871 Recognized Expert Specialist
What is your platform? Normally, you would use the onclick event and check the selected value.
Mar 12 '07 #2
madushan
15 New Member
What is your platform? Normally, you would use the onclick event and check the selected value.

hi
I think it is not a big task

1. u select the subitem from the listview
2. then take the Text or value what is there in the subitem
3.Dependin on that u can do what u want

to select the perticular row ,column u can used bellow mention code if u want
but there are other ways also.

private void GetColumnRow(Po int hitPoint, out int row, out int column)
{
row = -1;
column = -1;

try
{
ListViewItem Item = lvwGroupInfo.Ge tItemAt(hitPoin t.X,hitPoint.Y) ;
if (!(Item == null))
{
int I = 0;
Rectangle R = Item.GetBounds( ItemBoundsPorti on.Icon);
while ((I < lvwGroupInfo.Co lumns.Count))
{
if (R.Contains(hit Point.X,hitPoin t.Y))
{
row = Item.Index;
//row =(int)Item.Tag;
column = I;
break;
}

R.X = (R.X + lvwGroupInfo.Co lumns[i].Width);
if (I+1 < lvwGroupInfo.Co lumns.Count)
{
R.Width = lvwGroupInfo.Co lumns[(I + 1)].Width;
}
I = (I + 1);
}
}
}
catch(Exception ex)
{

}
}


is this the answer for u?

madushan
Mar 12 '07 #3

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

Similar topics

7
24099
by: GTi | last post by:
I have a listview that with selected items. But I want to "reselect" items after a refresh. Each items have a uniqe value in the Tag object. After a refresh some new items may be added or removed so using item index is not possible. To get the list of selected items I use: ListView.SelectedListViewItemCollection selItems = this.listView1.SelectedItems;
2
3468
by: billyb | last post by:
My listview has two columns: Email Address & Email Address Type. I've figured out how to populate it, but now I'm having trouble figuring out how to properly use the SelectedItems to get at the particular row that is double clicked. Can someone give me an example of how to get at the item, and subitems, of a selected row in a listview? Thanks, billy
6
22127
by: George | last post by:
Hi all, How can I get the value stored from the selected item and subitems of a listview? Thanks in advance, George
3
11621
by: sstein | last post by:
Hi, I am having a bit of trouble with some C# code. I can get it working in VB.NET, but can't seem to work out how to get the same code working in C#. I have a listview which stores information about employees. Basically Day, Hours Worked, Hours Off, Absence Reason, Subs, Pay for day.
0
5960
by: =?Utf-8?B?TWlrZSBDb2xsaW5z?= | last post by:
I have a listview that when I select an item, it populates a details view. I want to show the item that was selected in the listview by changing it to yellow. Trouble is, the selected item does not show as yellow until I've clicked the same item two times. What am I doing wrong on the selected item that keeps it from changing to yellow until the item is clicked two times? Also, I have to set the listviews selectedIndex in the...
0
7970
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...
1
8036
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8259
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
6695
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
5847
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
3886
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
3930
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1494
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1241
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.