In my application i write the code like this
byte[] byt = new byte[Convert.ToSbyte(textbox1.Text)];
it is giving the error that input string was not in a correct format.
In my application i write the code like this
byte[] byt = new byte[Convert.ToSbyte(textbox1.Text)];
it is giving the error that input string was not in a correct format.
The text in textbox1 is not a valid numeral for a signed byte.
Does it have spaces? Letters? ...?
what you want in fact is this
// C# to convert a string to a byte array.
public static byte[] StrToByteArray(string str)
{
System.Text.ASCIIEncoding encoding=new System.Text.ASCIIEncoding();
return encoding.GetBytes(str);
}