继承VB.NET中的问题 [英] Inherits problems in VB.NET

查看:107
本文介绍了继承VB.NET中的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 ' 继承问题? 
< span class =code-keyword>私有 Sub Button2_Click(发件人作为 对象,e As EventArgs)句柄 Button2.Click
Dim form10 作为 表单()

' use for here for form10

Dim 作为 按钮
but.Text = 回复我
form10.Controls.Add(但是)
form10.ShowDialog()
结束 Sub





什么我试过了:



'继承问题我不知道怎么'继承这个?

解决方案

我正在尝试使用感觉并从form1看起来

通过继承方法


嗯,你不做就像那样 - 你通过使用Inherits从Form1而不是基本的Form类派生你的表单来实现它:如何:继承Windows窗体 [ ^ ]解释了它的全部内容。


好吧,我们不明白你的意思是:如何继承在此......



我建议回归基础:

的Windows表单可视继承 [ ^ ]

从Microsoft的基类继承。 NET [ ^ ]

在Visual Basic中继承 [< a href =https://msdn.microsoft.com/en-us/library/5x4yd9d5(v=vs.90).aspx\"target =_ blanktitle =New Window> ^ ]

何时使用继承 [< a href =https://msdn.microsoft.com/en-us/library/27db6csx(v=vs.90).aspx\"target =_ blanktitle =New Window> ^ ]

'Inherits problems ?
  Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Dim form10 As New Form()

'use Inherits here for form10 

        Dim but As New Button
        but.Text = "Reply me "
        form10.Controls.Add(but)
        form10.ShowDialog()
    End Sub



What I have tried:

'Inherits problems i got no idea how to 'Inherits in this ?

解决方案

"well am trying to use feel and look from form1
by inherits methord"

Well, you don't do it like that - you do it by deriving your form from Form1 instead of the basic Form class using Inherits: How to: Inherit Windows Forms[^] explains what it is all about.


Well, we have no idea what you mean by saying: "how to 'Inherits in this"...

I'd suggest to get back to basics:
Windows Forms Visual Inheritance[^]
Inheritance from a Base Class in Microsoft .NET[^]
Inheritance in Visual Basic[^]
When to Use Inheritance[^]


这篇关于继承VB.NET中的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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