1

I want convert char to string,How can I do?

char[] buf;
Int32 dwsize;
buf = new char[256];
dwsize = 256;
if (Pxx_ATE.GetProjectName(DeviceId, decimal.ToInt32(up_ProIndex.Value), buf, dwsize))
{
  textBox_projName.Text = buf; //Here error,I want convert buf to string
}
0

1 Answer 1

0

replace

textBox_projName.Text = buf;

with

textBox_projName.Text = new string(buf);
Sign up to request clarification or add additional context in comments.

1 Comment

I tested, it's ok: char[] buf = new char[256]; buf = "demo".ToCharArray(); textBox_projName.Text = new string(buf);

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.