吉橙科贸 YEWIN.TAOBAO.COM

https://weidian.com/?userid=475679779 电脑网络维护 ASP+编程 网络推广 系统集成 IT信息化管理系统...

asp. net(vb脚本)调用C#写的MobileBlockCTRL.dll档

1.aspx

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" %>
<%@ Import Namespace="MobileBlockCTRL.Class1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>测试DLL</title>
</head>
<body>
    <form id="form1" runat="server" action=Default2.aspx>
    <div>
        阿贵测试DLL<br />
    
    <hr><%=Now()%>&nbsp;
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
        <asp:Button ID="Button1" runat="server" Text="add" />
        <asp:Button ID="Button2" runat="server" Text="*" />
        <asp:Button ID="Button3" runat="server" Text="returnNow" />
        <asp:Label ID="Label1" runat="server" Text="Label" Width="169px"></asp:Label></div>
    </form>
</body>
</html>

---------------------------------------------------------------------------------------------------
2.aspx.vb

Partial Class Default2

    Inherits System.Web.UI.Page

    Dim obj As New MobileBlockCTRL.Class1
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

        Label1.Text = obj.add(TextBox1.Text, TextBox2.Text)
    End Sub

    Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
        Label1.Text = obj.multiply(TextBox1.Text, TextBox2.Text)
    End Sub

    Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
        Label1.Text = obj.return_datetime()
        '.ToString

    End Sub
End Class

--------------------------------------------------------
3. MobileBlockCTRL.dll

using System;
using System.Collections.Generic;
using System.Text;

namespace MobileBlockCTRL
{
    public class Class1
    {
        public string add(string str1,string str2)
        {
            return str1 + str2;
        }
        public string multiply(string long1, string long2)
        {
            return (long.Parse(long1) * long.Parse(long2)).ToString();
        }
        public static string return_datetime()
        {
            return DateTime.Now.ToLongDateString() + DateTime.Now.ToLongTimeString();
        }
    }
}

阅读更多
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭