十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
在所有kill执行完毕以后输出一个批处理文件,用途是删除卸载程序,在退出时调用它。
创新互联公司专业为企业提供利州网站建设、利州做网站、利州网站设计、利州网站制作等企业网站建设、网页设计与制作、利州企业网站模板建站服务,10多年利州做网站经验,不只是建网站,更提供有价值的思路和整体网络服务。
Private Sub Command1_Click()
Open App.Path + "\1.bat" For Binary As #1
Put #1, , "del " + App.EXEName + ".exe" vbCrLf
Put #1, , "del 1.bat"
Close #1
End Sub
Private Sub Form_Unload(Cancel As Integer)
Shell App.Path + "\1.bat"
End Sub
由于你要求的是能够动态的加载与卸载,所以这里选用了appdomain的load方法来加载一个程序集(同样的,卸载的时候调用appdomain的静态方法Unload即可).
另外由于,在appdomain.load的时候remoting会试图将程序集序列化到defaultdomain中去,这会产生问题,通常以一个"FileNotFoundException"结束,因此采用了一种折中的办法.
思路如下:
1.建立一个新的程序集,里面包含一个轻量的类型,这个类型只包含一个用来加载程序集的公共方法;
2.在你的主程序里面,用appdomain.load来加载上一步的程序集,接着实例化上一步的轻量的类型;
3.而后就可以像操作通常的对象一样,调用它上面的方法来加载你想要的程序集了;
源代码已经打包发给你了,
你看看吧~
如果有问题,再找我哈
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
binddata()
End If
End Sub
Public Sub binddata()
'
End Sub
'编辑中
Protected Sub GridView1_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GridView1.RowEditing
GridView1.EditIndex = e.NewEditIndex
'当前编辑行背景色高亮
GridView1.EditRowStyle.BackColor = Color.FromName("#F7CE90")
binddata()
End Sub
'分页
Protected Sub GridView1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles GridView1.PageIndexChanging
GridView1.PageIndex = e.NewPageIndex
binddata() '重新绑定GridView数据的函数
End Sub
'更新
Protected Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GridView1.RowUpdating
Dim clsB As New sqlDLTP.business
Dim sqlstr As String
Dim ds As New DataSet
sqlstr = "select hbdwno from etsshbd where hbdcnm='" CType(GridView1.Rows(e.RowIndex).FindControl("TextBox1"), TextBox).Text.ToString().Trim() "'"
ds = clsB.queryitems(sqlstr)
Dim wno As String = ds.Tables(0).Rows(0)(0).ToString().Trim()
sqlstr = "update etsdl set okscore1='" _
CType(GridView1.Rows(e.RowIndex).FindControl("TextBox6"), TextBox).Text.ToString().Trim() "',okscore2='" _
CType(GridView1.Rows(e.RowIndex).FindControl("TextBox7"), TextBox).Text.ToString().Trim() "',okscore='" _
CType(GridView1.Rows(e.RowIndex).FindControl("TextBox8"), TextBox).Text.ToString().Trim() "',okreport='" _
CType(GridView1.Rows(e.RowIndex).FindControl("TextBox9"), TextBox).Text.ToString().Trim() "',okgrad='" _
CType(GridView1.Rows(e.RowIndex).FindControl("TextBox10"), TextBox).Text.ToString().Trim() "',memo='" _
CType(GridView1.Rows(e.RowIndex).FindControl("TextBox12"), TextBox).Text.ToString().Trim() "' where trano='" _
GridView1.DataKeys(e.RowIndex).Value.ToString() "' and wno='" wno "'"
clsB.ExeSqlCmd(sqlstr)
GridView1.EditIndex = -1
binddata()
End Sub
'取消
Protected Sub GridView1_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GridView1.RowCancelingEdit
GridView1.EditIndex = -1
binddata()
End Sub
'删除
Protected Sub GridView1_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GridView1.RowDeleting
Dim clsB As New sqlDLTP.business
Dim sqlstr As String
Dim ds As New DataSet
sqlstr = "select hbdwno from etsshbd where hbdcnm='" CType(GridView1.Rows(e.RowIndex).FindControl("Label1"), Label).Text.ToString().Trim() "'"
ds = clsB.queryitems(sqlstr)
Dim wno As String = ds.Tables(0).Rows(0)(0).ToString().Trim()
sqlstr = "delete etsdl where trano=" GridView1.DataKeys(e.RowIndex).Value.ToString().Trim() "and wno='" wno "'"
clsB.ExeSqlCmd(sqlstr)
binddata()
End Sub
'绑定行,特效及链接列属性分配等
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
'鼠标经过时,行背景色变
e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#E6F5FA'")
'鼠标移出时,行背景色变
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='#FFFFFF'")
' HyperLink列给链接值
CType(e.Row.Cells(1).FindControl("HyperLink1"), HyperLink).NavigateUrl = "javascript:void window.open('trashow.aspx?tno=" + CType(e.Row.Cells(1).FindControl("HyperLink1"), HyperLink).Text + "','', 'left='+(window.top.screen.width-454)/2+',top='+(window.top.screen.height-454)/2+',width=625,height=500,scrollbars=yes,resizeable=yes');"
'当有编辑列时,避免出错,要加的RowState判断
If e.Row.RowState = DataControlRowState.Normal Or e.Row.RowState = DataControlRowState.Alternate Then
If CType(e.Row.Cells(12).FindControl("Label11"), Label).Text = "1" Then
CType(e.Row.Cells(12).FindControl("Label11"), Label).Text = "在职"
End If
End If
End If
End Sub
前台:
asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" Width=100% BackColor="White" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" CellPadding="3" CellSpacing="1" GridLines="None" AllowPaging="True" AllowSorting="True"
!-- --
/asp:GridView
VB.net 加载窗体 form2.show() 卸载窗体 me.close()加载窗体和VB没啥区别,而卸载就截然不同了。附:VB 加载窗体 form2.show 卸载窗体 unload me
vb.net会在系统里.net,要想手工删除几乎是不可能的,建议你还是原有的反安装程序来卸载。