我自己写的一个ActiveX,想传递一个字符串进去,可是传不进去。请各位给看看,哪儿有问题。
namespace second
{
[Guid("42D2F9F9-CD03-4c14-B1FF-EC89A931B1AE")] public class pro : System.Windows.Forms.UserControl
{
private System.Windows.Forms.Button button1;
private System.ComponentModel.Container components = null;
private string mess; public pro()
{
// 该调用是 Windows.Forms 窗体设计器所必需的。
InitializeComponent(); // TODO: 在 InitComponent 调用后添加任何初始化 } protected override void Dispose( bool disposing )
{
if( disposing )
{
if( components != null )
components.Dispose();
}
base.Dispose( disposing );
} #region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器
/// 修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(8, 8);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(136, 23);
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// pro
//
this.Controls.Add(this.button1);
this.Name = "pro";
this.Size = new System.Drawing.Size(160, 40);
this.ResumeLayout(false); }
#endregion private void button1_Click(object sender, System.EventArgs e)
{
MessageBox.Show(mess);
}
public string Mess
{
get
{
return mess;
}
set
{
mess=value;
}
}
}
}
网页调用为:
<object id="hello"
classid="clsid:42D2F9F9-CD03-4C14-B1FF-EC89A931B1AE"
>
<param name="Mess" value="nihaomao">
</object>
可是点击后,mess是空值
namespace second
{
[Guid("42D2F9F9-CD03-4c14-B1FF-EC89A931B1AE")] public class pro : System.Windows.Forms.UserControl
{
private System.Windows.Forms.Button button1;
private System.ComponentModel.Container components = null;
private string mess; public pro()
{
// 该调用是 Windows.Forms 窗体设计器所必需的。
InitializeComponent(); // TODO: 在 InitComponent 调用后添加任何初始化 } protected override void Dispose( bool disposing )
{
if( disposing )
{
if( components != null )
components.Dispose();
}
base.Dispose( disposing );
} #region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器
/// 修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(8, 8);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(136, 23);
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// pro
//
this.Controls.Add(this.button1);
this.Name = "pro";
this.Size = new System.Drawing.Size(160, 40);
this.ResumeLayout(false); }
#endregion private void button1_Click(object sender, System.EventArgs e)
{
MessageBox.Show(mess);
}
public string Mess
{
get
{
return mess;
}
set
{
mess=value;
}
}
}
}
网页调用为:
<object id="hello"
classid="clsid:42D2F9F9-CD03-4C14-B1FF-EC89A931B1AE"
>
<param name="Mess" value="nihaomao">
</object>
可是点击后,mess是空值
<HEAD>
<title>批量上传</title>
<script id="clientEventHandlersJS" language="javascript">
<!-- function window_onload() {
Form1.obj01.Receive_Doc_ID = Form1.hidReceiveDocID.value; //赋值
Form1.obj01.uriString = Form1.hidUriString.value;
} //-->
</script>
</HEAD>
<body MS_POSITIONING="GridLayout" language="javascript" onload="return window_onload()" class="bodyCommon">
<form id="Form1" method="post" runat="server">
<INPUT id="hidReceiveDocID" style="Z-INDEX: 100; LEFT: 8px; WIDTH: 67px; POSITION: absolute; TOP: 8px; HEIGHT: 22px"
type="hidden" size="5" name="hidReceiveDocID" runat="server"><INPUT id="hidUriString" style="Z-INDEX: 101; LEFT: 80px; WIDTH: 67px; POSITION: absolute; TOP: 8px; HEIGHT: 22px"
type="hidden" size="5" name="hidUriString" runat="server">
<OBJECT id="obj01" height="800" width="700" classid="http:GiaqUpload.dll#GiaqUpload.UserControl1"
VIEWASTEXT>
<PARAM NAME="Receive_Doc_ID">
<PARAM NAME="uriString">
</OBJECT>
</form>
</body>
</HTML>------------
Receive_Doc_ID对应的就是你在ActiveX中的public变量