powered by simpleCommunicator - 2.0.60     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / WinForms, .Net Framework [игнор отключен] [закрыт для гостей] / Как получить техт из выделеного itema в ListView
8 сообщений из 8, страница 1 из 1
Как получить техт из выделеного itema в ListView
    #32402387
subj
...
Рейтинг: 0 / 0
Как получить техт из выделеного itema в ListView
    #32402458
Артем1
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Так разве не работает ?
Код: plaintext
ListView.SelectedItems.Item[ 0 ].Text
...
Рейтинг: 0 / 0
Как получить техт из выделеного itema в ListView
    #32402542
че то нет
...
Рейтинг: 0 / 0
Как получить техт из выделеного itema в ListView
    #32402565
Артем1
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Проверил, все работает. Только элемент в ListView не забудь выделить.
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace WindowsApplication2
{
	/// <summary>
	/// Summary description for Form1.
	/// </summary>
	public class Form1 : System.Windows.Forms.Form
	{
		private System.Windows.Forms.ListView listView1;
		private System.Windows.Forms.Button button1;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public Form1()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			System.Windows.Forms.ListViewItem listViewItem1 = new System.Windows.Forms.ListViewItem( "парарам" );
			this.listView1 = new System.Windows.Forms.ListView();
			this.button1 = new System.Windows.Forms.Button();
			this.SuspendLayout();
			// 
			// listView1
			// 
			this.listView1.Items.AddRange(new System.Windows.Forms.ListViewItem[] {
																					  listViewItem1});
			this.listView1.Location = new System.Drawing.Point( 16 ,  64 );
			this.listView1.Name =  "listView1" ;
			this.listView1.TabIndex =  0 ;
			// 
			// button1
			// 
			this.button1.Location = new System.Drawing.Point( 200 ,  32 );
			this.button1.Name =  "button1" ;
			this.button1.TabIndex =  1 ;
			this.button1.Text =  "button1" ;
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size( 5 ,  13 );
			this.ClientSize = new System.Drawing.Size( 292 ,  273 );
			this.Controls.Add(this.button1);
			this.Controls.Add(this.listView1);
			this.Name =  "Form1" ;
			this.Text =  "Form1" ;
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new Form1());
		}

		private void button1_Click(object sender, System.EventArgs e)
		{
			MessageBox.Show(this, listView1.SelectedItems[ 0 ].Text);
		}
	}
}
...
Рейтинг: 0 / 0
Как получить техт из выделеного itema в ListView
    #32402587
ListView.SelectedItems.Item[0].Text

listView1.SelectedItems[0].Text - так работает

Кстати не скажешь где почитать про listView, (MSDN знаем но его нет)
...
Рейтинг: 0 / 0
Как получить техт из выделеного itema в ListView
    #32402620
Артем1
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
А читал я в Help-е к .NET - .NET Framework Class Library.
Еще наверное можно почитать у Петцольда, но больно у него толстые книги, да и дорого.
В основном по форумам и по help-у.
...
Рейтинг: 0 / 0
Как получить техт из выделеного itema в ListView
    #32402630
Ладно пасибо
...
Рейтинг: 0 / 0
Как получить техт из выделеного itema в ListView
    #32403062
Artem Ryabko
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Привет у меня таже проблема, будем надеяться что кто-то поможет...
...
Рейтинг: 0 / 0
8 сообщений из 8, страница 1 из 1
Форумы / WinForms, .Net Framework [игнор отключен] [закрыт для гостей] / Как получить техт из выделеного itema в ListView
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]