日期:2014-05-18 浏览次数:20826 次
//================================================================================================================ //VB6.0事件处理 OnReceive()如下,收发数据正常。 //Private Sub Command1_Click() //FinsMsg1.sendFinsCommand 0, 1, 0, "0101820064000002" //End Sub //Private Sub FinsMsg1_OnReceive() //Dim net As Integer, node As Integer, unit As Integer //Text1.Text = FinsMsg1.receiveMessage(net, node, unit, vbString) //End Sub //================================================================================================================ private void button1_Click(object sender, EventArgs e) { axFinsMsg1.sendFinsCommand(0, 1, 0, "0101820064000002"); } private void axFinsMsg1_OnReceive(object sender, EventArgs e) { //public virtual object receiveMessage(ref short netID, ref short nodeID, ref short unitID, object messageType) //AxFINSMSGCTLLib.AxFinsMsg 的成员 short a=0,b=0,c=0; object temp=new object(); textBox1.Text = axFinsMsg1.receiveMessage(ref a,ref b,ref c,temp); //错误 1 无法将类型“object”隐式转换为“string”。存在一个显式转换(是否缺少强制转换?) }
textBox1.Text = axFinsMsg1.receiveMessage(ref a,ref b,ref c,temp.toString());
------解决方案--------------------
receiveMessage是返回什么类型,如果是object,你需要 ToString(),才能赋值给Text