这是我的课程表格:
The following Entity Framework cmdlets are used with Entity Framework
Migrations.
Cmdlet Description
----------------- ---------------------------------------------------
Enable-Migrations Enables Code First Migrations in a project.
Add-Migration Scaffolds a migration script for any pending model
changes.
Update-Database Applies any pending migrations to the database.
Get-Migrations Displays the migrations that have been applied to
the target database
这是我的用户形式:
Public Class mailmessage
Property msgsubject As String
Property msgto As String
Property msgfrom As String
Property msgbody As String
Property msgcc As String
public function sendMsg()
end function
end class
我假设我正确设置它,以便assignmsg.sendMsg代表" assignmsg"激活sendMsg函数。
我的问题是,我想让sendMsg函数执行以下操作:
Sub reassign()
Dim assignmsg As New mailmessage
With assignmsg
.msgsubject = "A new task has been assigned to you."
.msgfrom = Environment.UserName & "@" & companyDomain.text & ".com"
.msgbody = Textbox5.text
.msgto = mailRecipent.text
End With
assignmsg.sendMsg()
End Sub
我如何告诉它将变量从我创建的assignMsg对象(assignmsg.msgto)转换为函数中的字符串?
答案 0 :(得分:0)
你的问题不是很清楚,这里有一个建议基于一个变体问题:如何将一些上下文信息传递给新对象。
通过以下方式调用:
Dim mm As New mailmessage(mailmessage.etype.Hello)
mm.msgbody = "Hello World"
'mm. ....
mm.sendMsg()
Public Class mailmessage
Enum etype
Hello
GoodBy
StilInterested
End Enum
Private _type As etype = Nothing
Property msgsubject As String
Property msgto As String
Property msgfrom As String
Property msgbody As String
Property msgcc As String
Public Sub sendMsg()
Select Case _type
Case etype.Hello
'... log hello message
Case Else
'...
End Select
' send
End Sub
Sub New(Optional MailType As etype = Nothing)
_type = MailType
End Sub
End Class