vba listview控件件怎么用啊?推荐个好的网址啊

vb ListView控件用法_百度知道
vb ListView控件用法
建立好数据库后,怎么在LISTVIEW里读出数据库表的(行)和(例)的内容.意思就是读取数据库表的内容到LISTVIEW控件中.追分..................
提问者采纳
Dim i As IntegerWith Me.ListView1 .View = lvwReport
For i = 0 To Me.Text1.Count - 1
.ColumnHeaders.Add , , &xx& & i
End WithWith Me.ListView1
Dim oListItem As ListItem
Set oListItem = .ListItems.Add(, , rs.fields(0).Value)
For i = 1 To Me.Text1.Count - 1
oListItem.SubItems(i) = rs.fields(i).Value
Next iEnd With
其他类似问题
listview控件的相关知识
您可能关注的推广
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁ASP.NET中listview控件的用法?-.NET技术/ASP.NET-asp.net-电脑编程网ASP.NET中listview控件的用法?-.NET技术/ASP.NET作者:daizhen256 和相关&&一开始报错说:必须在 ListView“itemPlaceholder”上指定项占位符。可通过将控件的 ID 的属性设置为“itemPlaceholder”来指定项占位符。项占位符控件还必须指定 runat=&server&。于是我在其下面添加了一个placeholder控件,并将listview的itemplaceholderid改成了后添加的placeholder控件的ID,结果还是报一样的错,我究竟错在哪呢?------回答---------------其他回答(40分)---------C# code
LayoutTemplate 模板是 ListView 控件所必需的。LayoutTemplate 内容必须包含一个占位符控件,例如由 ItemTemplate 模板定义的项表行 (tr) 元素。占位符控件必须将 runat 属性 (Attribute) 设置为“server”,将 ID 属性 (Attribute) 设置为 ItemPlaceholderID 或 GroupPlaceholderID 属性 (Property) 的值(具体取决于 ListView 控件是否使用组)。
例如:
前端代码:
ListView演示前端代码
&:ListView ID=&ListView1& runat=&server&&
&ItemTemplate&
&tr&
&td runat=&server& style=&&&
&:Label ID=&idLabel& runat=&server& Text='&%# Eval(&name&) %&' /&
&br /&
&/td&
&td&
&asp:Label ID=&xLabel& runat=&server& Text='&%# Eval(&Age&) %&' /&
&br /&
&/td&
&/tr&
&/ItemTemplate&
&LayoutTemplate&
&table runat=&server& border=&0& style=&&&
[color=#FF0000]&tr runat=&server& id=&itemPlaceholder& /&[/color]
&/table&
&/LayoutTemplate&
&/asp:ListView&
------回答---------------其他回答(40分)---------
C# code
LayoutTemplate 模板是 ListView 控件所必需的。LayoutTemplate 内容必须包含一个占位符控件,例如由 ItemTemplate 模板定义的项表行 (tr) 元素。占位符控件必须将 runat 属性 (Attribute) 设置为“server”,将 ID 属性 (Attribute) 设置为 ItemPlaceholderID 或 GroupPlaceholderID 属性 (Property) 的值(具体取决于 ListView 控件是否使用组)。
例如:
前端代码:
ListView演示前端代码
&asp:ListView ID=&ListView1& runat=&server&&
&ItemTemplate&
&tr&
&td runat=&server& style=&&&
&asp:Label ID=&idLabel& runat=&server& Text='&%# Eval(&name&) %&' /&
&br /&
&/td&
&td&
&asp:Label ID=&xLabel& runat=&server& Text='&%# Eval(&Age&) %&' /&
&br /&
&/td&
&/tr&
&/ItemTemplate&
&LayoutTemplate&
&table runat=&server& border=&0& style=&&&
[color=#FF0000]&tr runat=&server& id=&itemPlaceholder& /&[/color]
&/table&
&/LayoutTemplate&
&/asp:ListView&
相关资料:|||||||ASP.NET中listview控件的用法?-.NET技术/ASP.NET来源网络,如有侵权请告知,即处理!编程Tags:                &                    在一个窗体里面定义的LISTVIEW控件,在另一个窗体怎么用?
[问题点数:0分]
在一个窗体里面定义的LISTVIEW控件,在另一个窗体怎么用?
[问题点数:0分]
不显示删除回复
显示所有回复
显示星级回复
显示得分回复
只显示楼主
相关帖子推荐:
本帖子已过去太久远了,不再提供回复功能。源码下载地址:
需求:获取其他程序中的ListView控件的文本内容
原理:进程之间是相互隔离的,数据是不能共享的(有些特例)
   LVM_GETTITEMTEXT:将一个数据缓冲区提供给listview32控件,你不能把你的进程的数据缓冲提供给另外的程序,所以要用openprocess&打开“任务管理器”进程,&然后   &&在“任务管理器进程”中申请足够长度的内存(VirualAllocEx),将这个内存地址提供给listview32,使用&sendmessage&发送LVM_GETTITEMTEXT消息,待sendmessage返 &    &&回后,用readprocessmemory&读取这段内存的数据,即listview控件的文本内容
FindWindow   & & & & & & & & &//查找窗口FindWindowEx & & & & & & & & & &////在窗口列表中寻找与指定条件相符的第一个子窗口SendMessageGetWindowThreadProcessId//找出某个窗口的创建者(线程或进程),返回创建者的标志符OpenProcess         &//打开一个已存在的进程对象,并返回进程的句柄VirtualAllocEx & & & & & & & & & &//为指定的进程分配内存地址:成功则返回分配内存的首地址ReadProcessMemory & & & & &//从指定内存中读取字节集数据WriteProcessMemory & & & & //将数据写入内存中CloseHandleVirtualFreeEx & & & & & & & & & //在其它进程中释放申请的虚拟内存空间
using System.Collections.G
using System.D
using System.D
using System.L
using System.T
using System.Threading.T
using System.Windows.F
using System.Runtime.InteropS
namespace 读取其他软件listview控件的内容
public partial class Form1 : Form
//窗口句柄
//进程句柄
private const uint LVM_FIRST = 0x1000;
private const uint LVM_GETHEADER = LVM_FIRST + 31;
private const uint LVM_GETITEMCOUNT = LVM_FIRST + 4;//获取列表行数
private const uint LVM_GETITEMTEXT = LVM_FIRST + 45;//获取列表内的内容
private const uint LVM_GETITEMW = LVM_FIRST + 75;
private const uint HDM_GETITEMCOUNT = 0x1200;//获取列表列数
private const uint PROCESS_VM_OPERATION = 0x0008;//允许函数VirtualProtectEx使用此句柄修改进程的虚拟内存
private const uint PROCESS_VM_READ = 0x0010;//允许函数访问权限
private const uint PROCESS_VM_WRITE = 0x0020;//允许函数写入权限
private const uint MEM_COMMIT = 0x1000;//为特定的页面区域分配内存中或磁盘的页面文件中的物理存储
private const uint MEM_RELEASE = 0x8000;
private const uint MEM_RESERVE = 0x2000;//保留进程的虚拟地址空间,而不分配任何物理存储
private const uint PAGE_READWRITE = 4;
private int LVIF_TEXT = 0x0001;
[DllImport(&user32.dll&)]//查找窗口
private static extern int FindWindow(
string strClassName,
//窗口类名
string strWindowName
//窗口标题
[DllImport(&user32.dll&)]//在窗口列表中寻找与指定条件相符的第一个子窗口
private static extern int FindWindowEx(
int hwndParent, // handle to parent window
int hwndChildAfter, // handle to child window
string className, //窗口类名
string windowName // 窗口标题
[DllImport(&user32.DLL&)]
private static extern int SendMessage(int hWnd, uint Msg, int wParam, int lParam);
[DllImport(&user32.dll&)]//找出某个窗口的创建者(线程或进程),返回创建者的标志符
private static extern int GetWindowThreadProcessId(int hwnd,out int processId);
[DllImport(&kernel32.dll&)]//打开一个已存在的进程对象,并返回进程的句柄
private static extern int OpenProcess(uint dwDesiredAccess, bool bInheritHandle,int processId);
[DllImport(&kernel32.dll&)]//为指定的进程分配内存地址:成功则返回分配内存的首地址
private static extern int VirtualAllocEx(int hProcess, IntPtr lpAddress, uint dwSize, uint flAllocationType, uint flProtect);
[DllImport(&kernel32.dll&)]//从指定内存中读取字节集数据
private static extern bool ReadProcessMemory(
int hProcess, //被读取者的进程句柄
int lpBaseAddress,//开始读取的内存地址
IntPtr lpBuffer, //数据存储变量
int nSize, //要写入多少字节
ref uint vNumberOfBytesRead//读取长度
[DllImport(&kernel32.dll&)]//将数据写入内存中
private static extern bool WriteProcessMemory(
int hProcess,//由OpenProcess返回的进程句柄
int lpBaseAddress, //要写的内存首地址,再写入之前,此函数将先检查目标地址是否可用,并能容纳待写入的数据
IntPtr lpBuffer, //指向要写的数据的指针
int nSize, //要写入的字节数
ref uint vNumberOfBytesRead
[DllImport(&kernel32.dll&)]
private static extern bool CloseHandle(int handle);
[DllImport(&kernel32.dll&)]//在其它进程中释放申请的虚拟内存空间
private static extern bool VirtualFreeEx(
int hProcess,//目标进程的句柄,该句柄必须拥有PROCESS_VM_OPERATION的权限
int lpAddress,//指向要释放的虚拟内存空间首地址的指针
uint dwSize,
uint dwFreeType//释放类型
/// &summary&
/// LVITEM结构体,是列表视图控件的一个重要的数据结构
/// 占空间:4(int)x7=28个byte
/// &/summary&
private struct LVITEM
//说明此结构中哪些成员是有效的
public int iI//项目的索引值(可以视为行号)从0开始
public int iSubI //子项的索引值(可以视为列号)从0开始
//子项的状态
public int stateM //状态有效的屏蔽位
public IntPtr pszT
//主项或子项的名称
public int cchTextM//pszText所指向的缓冲区大小
public Form1()
InitializeComponent();
/// &summary&
/// LV列表总行数
/// &/summary&
private int ListView_GetItemRows(int handle)
return SendMessage(handle,LVM_GETITEMCOUNT,0,0);
/// &summary&
/// LV列表总列数
/// &/summary&
private int ListView_GetItemCols(int handle)
return SendMessage(handle, HDM_GETITEMCOUNT, 0, 0);
private void button1_Click(object sender, EventArgs e)
//listview控件的列头句柄
//listview控件中的行列数
int processId; //进程pid
hwnd = FindWindow(&#32770&, &Windows 任务管理器&);
hwnd = FindWindowEx(hwnd, 0, &#32770&,null);
hwnd = FindWindowEx(hwnd, 0, &SysListView32&,null);//进程界面窗口的句柄,通过SPY获取
headerhwnd = SendMessage(hwnd, LVM_GETHEADER, 0, 0);//listview的列头句柄
rows=ListView_GetItemRows(hwnd);//总行数,即进程的数量
cols = ListView_GetItemCols(headerhwnd);//列表列数
GetWindowThreadProcessId(hwnd, out processId);
//打开并插入进程
process = OpenProcess(PROCESS_VM_OPERATION | PROCESS_VM_READ | PROCESS_VM_WRITE, false,processId);
//申请代码的内存区,返回申请到的虚拟内存首地址
pointer = VirtualAllocEx(process, IntPtr.Zero, 4096, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
string[,] tempS//二维数组
string[] temp = new string[cols];
tempStr=GetListViewItmeValue(rows,cols);//将要读取的其他程序中的ListView控件中的文本内容保存到二维数组中
listView1.Items.Clear();//清空LV控件信息
//输出数组中保存的其他程序的LV控件信息
for (int i = 0; i & i++)
for (int j = 0; j &j++ )
temp[j]=tempStr[i,j];
ListViewItem lvi = new ListViewItem(temp);
listView1.Items.Add(lvi);
/// &summary&
/// 从内存中读取指定的LV控件的文本内容
/// &/summary&
/// &param name=&rows&&要读取的LV控件的行数&/param&
/// &param name=&cols&&要读取的LV控件的列数&/param&
/// &returns&取得的LV控件信息&/returns&
private string[,] GetListViewItmeValue(int rows,int cols)
string[,] tempStr = new string[rows,cols];//二维数组:保存LV控件的文本信息
for (int i = 0; i &i++ )
for (int j = 0; j &j++ )
byte[] vBuffer = new byte[256];//定义一个临时缓冲区
LVITEM[] vItem = new LVITEM[1];
vItem[0].mask = LVIF_TEXT;//说明pszText是有效的
vItem[0].iItem =
vItem[0].iSubItem =
vItem[0].cchTextMax = vBuffer.L//所能存储的最大的文本为256字节
vItem[0].pszText = (IntPtr)((int)pointer + Marshal.SizeOf(typeof(LVITEM)));
uint vNumberOfBytesRead = 0;
//把数据写到vItem中
//pointer为申请到的内存的首地址
//UnsafeAddrOfPinnedArrayElement:获取指定数组中指定索引处的元素的地址
WriteProcessMemory(process,pointer,Marshal.UnsafeAddrOfPinnedArrayElement(vItem,0),Marshal.SizeOf(typeof(LVITEM)), ref vNumberOfBytesRead);
//发送LVM_GETITEMW消息给hwnd,将返回的结果写入pointer指向的内存空间
SendMessage(hwnd, LVM_GETITEMW,i,pointer);
//从pointer指向的内存地址开始读取数据,写入缓冲区vBuffer中
ReadProcessMemory(process,((int)pointer + Marshal.SizeOf(typeof(LVITEM))),Marshal.UnsafeAddrOfPinnedArrayElement(vBuffer,0),vBuffer.Length, ref vNumberOfBytesRead);
string vText = Encoding.Unicode.GetString(vBuffer, 0, (int)vNumberOfBytesRead); ;
tempStr[i,j] = vT
VirtualFreeEx(process, pointer, 0, MEM_RELEASE);//在其它进程中释放申请的虚拟内存空间,MEM_RELEASE方式很彻底,完全回收
CloseHandle(process);//关闭打开的进程对象
return tempS
源码下载地址:
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:217380次
积分:2914
积分:2914
排名:第4390名
原创:67篇
转载:114篇
评论:53条
(1)(1)(1)(5)(1)(3)(3)(2)(3)(1)(1)(5)(2)(2)(1)(1)(2)(1)(1)(6)(1)(2)(1)(3)(2)(4)(2)(1)(5)(5)(1)(2)(12)(1)(2)(8)(8)(1)(3)(6)(1)(2)(1)(6)(4)(8)(1)(8)(3)(2)(5)(1)(1)(3)(11)(1)(10)您还未登陆,请登录后操作!
请问如何用delphi中的listview控件?
请问如何用delphi中的listview控件?
如图那样要怎样设置呢?
控件属性:
ViewStyle -> vsReport
Columns -> 添加需要的标题项
在程序中添加内容(假设listview控件名为ListView1):
d do begin
 Caption := '歌曲名称....';
SubItems.Add('歌手...');
SubItems.Add('...');
参考TListView,TListItems和TListItem的相关信息。
回答数:49
我想用dreamweaver在网页里的一......}

我要回帖

更多关于 listview 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信