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

getting data from selected listview item

2
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 1438
kenobewan
4,871 Expert 4TB
What is your platform? Normally, you would use the onclick event and check the selected value.
Mar 12 '07 #2
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(Point hitPoint, out int row, out int column)
{
row = -1;
column = -1;

try
{
ListViewItem Item = lvwGroupInfo.GetItemAt(hitPoint.X,hitPoint.Y);
if (!(Item == null))
{
int I = 0;
Rectangle R = Item.GetBounds(ItemBoundsPortion.Icon);
while ((I < lvwGroupInfo.Columns.Count))
{
if (R.Contains(hitPoint.X,hitPoint.Y))
{
row = Item.Index;
//row =(int)Item.Tag;
column = I;
break;
}

R.X = (R.X + lvwGroupInfo.Columns[i].Width);
if (I+1 < lvwGroupInfo.Columns.Count)
{
R.Width = lvwGroupInfo.Columns[(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
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...
2
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...
6
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
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...
0
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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...
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...
1
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...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.