C # textbox auto scroll to end scrolltocaret scrolling textbox
Usage of my sample C # codes,
I use textbox to write the results.
When textbox is multiline property set to true, and when I insert text into it,
I want it to auto scroll to the last line.
Here is a simple way to auto scrolling textbox.
Textbox1.selectionstart = textbox1.text. length;
Textbox1.scrolltocaret ();
Textbox1.refresh ();
Textbox selectionstart will force the Textbox Control to select the last part of the text,
And scrolltocaret () function will auto scroll textbox to the end.
C # convert hexadecimal to binary String Conversion
There is no need to code tons of codes, loops, to convertHEX to binary string.Convert. toint32Function is very useful for this purpose.
Let's convert the "A" character to binary format.
private string hex2binary(string hexvalue)
{
string binaryval = "";
binaryval = Convert.ToString(Convert.ToInt32(hexvalue, 16), 2);
return binaryval;
}
When we callHex2binary("A"); it will return "1010" similar samples below;
Hex2binary("1a"); Will return"11010";
Hex2bianry("1a2c"); Will return"1101000101100"; And so on.
Keep in mind that thisHEX to Binary ConversionStyle uses32 bit integerNumber.