换行或回车符语法问题

发布于 2024-09-04 19:56:54 字数 444 浏览 2 评论 0原文

我对编码还很陌生,这是我的问题。

Results->Text = "G55 > Y" + System::Convert::ToString(destY);

“结果”是一个System.Windows.Forms.Textbox“多行btw”,VS是这么说的。

该行工作正常,但我需要在末尾添加一个“新行或 CR”,以便我可以在 ToString 中使用不同的文字和不同的 var 重复该行。

几天来,我尝试了我读过的不同语法,但我无法让它接受其中任何一个。

或者甚至是一种完全不同的方式将文本输入到“结果”->“文本”中,从而允许整齐的多行使用。

旁注:由于我在 VC 中使用 ->Text 和 System::Convert::ToString,这段代码是否会被视为 c++、.net 或 CLI?加强我的搜索。

Im pretty new to coding, heres my problem.

Results->Text = "G55 > Y" + System::Convert::ToString(destY);

"Results" is a System.Windows.Forms.Textbox "multiline btw", or so says VS.

That line works fine, but i need a "new line or CR" at the end, so that i can repeat that line with different Literals and a different var in ToString.

For days now ive tried different syntax's ive read about, and i cant get it to take any of them.

Or even a complete different way to input text into Results->Text that would allow for tidy multiline use.

Sidenote: since im using ->Text and System::Convert::ToString in VC, would this code be considered just c++ or .net or CLI? to tighten my searches.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

不及他 2024-09-11 19:56:54

您尝试过System::Environment::NewLine吗?这将为您提供 Windows 上的 CrLf 以及这些平台上适用于 Linux/OS X 的任何内容。

Have you tried System::Environment::NewLine? This will give you CrLf on Windows and whatever is correct for Linux/OS X on those platforms.

静若繁花 2024-09-11 19:56:54

由于完全不熟悉 .NET,我可能完全错误,但在行尾添加 + "\n" 肯定可以完成这项工作吗?或者失败了,+“\r\n”

Being completely unfamiliar with .NET, I could be completely wrong, but surely adding a + "\n" to the end of your line would do the job? Or failing that, a + "\r\n"?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文