您的位置:程序门 -> .net技术 -> c#



一个类型转换的问题


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


一个类型转换的问题
发表于:2007-03-01 13:57:16 楼主
public   byte[]   read(int   numbytes)
                        {
                                byte[]   bufbytes;
                                byte[]   outbytes;
                                bufbytes   =   new   byte[numbytes];
                                if   (hcomm   !=   invalid_handle_value)
                                {
                                        overlapped   ovlcommport   =   new   overlapped();
                                        int   bytesread   =   0;
                                        readfile(hcomm,   bufbytes,   numbytes,   ref   bytesread,   ref   ovlcommport);
                                        outbytes   =   new   byte[bytesread];
                                        array.copy(bufbytes,   outbytes,   bytesread);
                                }
                                else
                                {
                                        throw   (new   applicationexception( "串口未打开! "));
                                }
                                return   outbytes;
                        }

上面的是从串口读数据

怎么样将读到的数据放入textbox.text里
发表于:2007-03-01 14:02:261楼 得分:0
textbox.text直接接收呀
发表于:2007-03-01 14:04:122楼 得分:0
textbox2.text   =read(1).tostring();   \\这样子是不行的
发表于:2007-03-01 14:11:153楼 得分:0
encoding.default.getstring(read(1));
发表于:2007-03-01 15:52:214楼 得分:0
?????
发表于:2007-03-01 16:16:105楼 得分:0
没有人知道吗
发表于:2007-03-01 16:21:316楼 得分:0
我给的代码有什么问题吗?

encoding.default.getstring(read(1));

会报错?显示不正确?你可以换成其他编码看看


快速检索

热门点击