如在Textbox1中输入abc
点击按钮,就能在另外一个Textbox2中显示abc对应的2进制数据,例如类似于"0100...."
跪求各位大神指导啊!

解决方案 »

  1.   

    http://blog.csdn.net/guyunmiyu/article/details/6671278
      

  2.   

    参考
    http://topic.csdn.net/t/20060729/23/4914315.html
      

  3.   

    string类没有对应的方法吗,如果没有,你讲字符串分割成耽搁字符,在网上肯定能搜到转化为二进制的方法,一个一个处理就行了
      

  4.   

    你的 这个 系统 就可以直接 解决了
    Convert.Toint32("11111111",2)  //==== 255
      

  5.   

    用最简单的方式 给你研究出来了,浪费了点时间。
    代码如下 :   string _16 = "abc";
                Dictionary<char, string> dic = new Dictionary<char, string>();
                char[] buffer = _16.ToCharArray();
                foreach (var byt in buffer)
                {
                    StringBuilder binaryStrs = new StringBuilder();
                    dic.Add(byt, null);
                    int quotient = Convert.ToInt32(byt.ToString(), 16);
                    while (true)
                    {
                        int result;
                        quotient = Math.DivRem(quotient, 2, out result);
                        if (result == 1 || result == 0)
                        {
                            binaryStrs.Insert(0, result.ToString()); 
                        }
                        if (quotient ==0)
                        {
                            break;
                        }
                    }
                    dic[byt] = binaryStrs.ToString().PadLeft(8, '0');
                }字典输出的结果是/*
    a,00001010
    b,00001011
    c,00001100
    */
      

  6.   

    楼主是要获取输入字符的ASCII码的二进制形式,还是把输入的字符看成16进制获取二进制形式啊?