错误:'新建不能在界面上使用' [英] error:' New cannot be used on an interface'

查看:77
本文介绍了错误:'新建不能在界面上使用'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码中出现以下错误,我使用打印预览进行打印:



i get the following error in my code which i am using to print using print preview:

Private Sub printpreBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles printpreBtn.Click
    Dim printer As New listViewPrinter(lvw, New Point(50, 50), True, lvw.Groups.Count > 0, "titleText")
    printer.print()
End Sub

推荐答案

如果 listViewPrinter 是一个接口,你无法初始化它。

你只能初始化类。
If listViewPrinter is an interface, you cannot initialize it.
You can only initialize classes.


你不能当然,创建一个接口的实例。您必须创建实现此类接口的类的对象(或调用方法,可能共享,返回实现此类接口的类的实例)。
You cannot create an instance of an interface, of course. You have to create an object of a class implementing such interface (or call a method, maybe shared, returning an instance of a class implementing such interface).


这篇关于错误:'新建不能在界面上使用'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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