通过接口实现类的问题 [英] problem with implementing class by Interface
本文介绍了通过接口实现类的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的朋友,
我正在使用.net远程项目.从我的角度来看,我将以下代码分为三段
项目.问题是,我无法获取LogInSuccessfull变量的值.
Dear Friends,
I am working with a .net remoting project. In my soution, i have the following code in three
projects. The problem is, i could not get value of LogInSuccessfull variable.
Public Interface MyInterface
Sub TryToLogIn(ByVal UserName As String, ByVal UserPassword As String)
ReadOnly Property LogInSuccessfull() As Boolean
End Interface
Imports System.Runtime.Remoting
Imports ClassInterfaces
Public Class ZoneLogIn
Inherits MarshalByRefObject
Implements ClassInterfaces.MyInterface
Private mLogInSuccesfull As Boolean
Public ReadOnly Property LogInSuccessfull() As Boolean Implements ClassInterfaces.MyInterface.LogInSuccessfull
Get
return mLogInSuccesfull
End Get
End Property
Public Sub TryToLogIn(ByVal UserName As String, ByVal UserPassword As String) Implements ClassInterfaces.MyInterface.TryToLogIn
mLogInSuccesfull =true
Console.WriteLine(mErrorMsg)
End Sub
End Class
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim test As ClassInterfaces.MyInterface
test = CType(Activator.GetObject(GetType(ClassInterfaces.MyInterface), "tcp://172.10.1.2:49341/ZoneLogIn.rem"), ClassInterfaces.MyInterface)
test.TryToLogIn("test", "1234")
MsgBox(test.LogInSuccessfull)
End Sub
您能帮我上面代码中缺少的内容吗?
提前谢谢您.
问候
SKPaul
Would you help me what i am missing in the above code?
Thanking you in advance.
Regards
SKPaul
推荐答案
您确定对象创建正确吗?从网址获取test IsNot Nothing
后可以检查吗?
Are you sure the object is created properly? Can you check if test IsNot Nothing
after getting it from the URL?
这篇关于通过接口实现类的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文