I have to make a program for school, a D-FlipFlop. To enter D and the e/clock I want to use 2 textboxes. (I also had to make a program with 3 ports that contain AND, NAND, OR, NOR, XOR ports, but that already works).
Input for D can be: 000001111100000111111100000011
Input for E can be: 000111000111000111000111000111
The value from textbox1 must go to a picturebox. So that with 0 and 1 you can draw a line and make the flipflop visual. The value from textbox2 needs to go to picturebox2.
This is possible. You’ll actually need to convert
000001111100000111111100000011or000111000111000111000111000111which will be treated asstringto a byte arraybyte[]. To do this, we’ll useConvert.ToByte(object value, IFormatProvider provider)This will declare a new string
inputand then encode it to a byte array (byte[]). We’ll actually need this as abyte[]to be able to use it as aStreamand then insert it into ourPictureBox. To do this, we’ll useMemoryStreamFinally, we can simply use this stream to create our
Imagefile and set the file to ourPictureBoxExample
By using this, you can whenever call, for example
Decode(000001111100000111111100000011)and it will convert it to an image for you. Then, you may use this code to set theImageproperty of aPictureBoxIMPORTANT NOTICE: You may receive
ArgumentException was unhandled: Parameter is not valid.this might happen due to an invalid Binary code.Thanks,
I hope you find this helpful 🙂