类库dll中的ListView错误。请帮忙 [英] ListView error in class library dll. Please help

查看:50
本文介绍了类库dll中的ListView错误。请帮忙的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作dll文件,为此我创建了类库项目并添加了类ListView

在我的类库项目中,listview属性正在显示。下面的代码在windows窗体项目的类中工作,但是相同的代码在类库项目中不起作用。

我在代码库中使用下面的代码

I am making dll file and for this pupose i created class library project and added class ListView
In my class library project listview properties are showing. Below code works in class in windows form project but same code does not work in class library project.
I am using below code into class library

Imports System.Windows.Forms
Imports System.Data.SqlClient
Public Class ListView
    Public Shared Function FillListView(ByVal lvw As ListView, ByVal dt As DataTable)
        lvw.view = View.Details
        lvw.GridLines = True
        lvw.FullRowSelect = True
        lvw.Columns.Clear()
        lvw.Items.Clear()
     End Function
End Class 





在此代码后面的行给出错误。它说视图不是成员DbLib.ListView和它说的相同关于Gridlines,FullRowSelect,Columns.Items等。



In this code following lines giving error.It says view is not a member of DbLib.ListView and it says same about Gridlines, FullRowSelect, Columns.Items etc.

lvw.view = View.Details
lvw.GridLines = True
lvw.FullRowSelect = True
lvw.Columns.Clear()
lvw.Items.Clear()



我希望得到帮助和指导。请帮助我。


I hope for help and guidence. Please help me.

推荐答案

您不应该将您的类命名为ListView,因为已经在System.Windows.Forms命名空间中定义了这样的类。



更好:

You should not name your class ListView, because there already is such a class defined in System.Windows.Forms namespace.

Better do:
using System.Windows.Forms;

public class MyListView : ListView
{
   // ...
}





这样你就可以继承基本的ListView类,并能够使用它存在的所有属性和方法。



This way you will inherit tthe base ListView class, and be able to use all its existent properties and methods.


这篇关于类库dll中的ListView错误。请帮忙的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆