引用Winform表格的问题
我的bean有一个问题引用我在main中初始化的winform表单,引用的代码如下,
Form1 f1 = new Form1();
Application.Run(f1);
f1.changeText("Hello World");
表单本身在另一个文件中定义。 f1.changeText是一个简单的函数,它获取字符串输入并将文本块元素设置为字符串,我在单击按钮的结果中调用表单类中的函数,并且可以正常工作,但是当我在MAIN中调用它时,我会得到没有结果。作为旁注,我有一个控制台。主要功能在主要方面也无能为力,但我不知道这是否相关。在上下文中,我使用的是Visual Studio,如果不是很明显,我没有太多在类似的课程和框架编码的经验。感谢您的帮助!
I have bean having a issue referencing a winform form I initialize in main, the code for the referencing is as follows,
Form1 f1 = new Form1();
Application.Run(f1);
f1.changeText("Hello World");
the form itself is defined in another file. f1.changetext is a simple function which takes a string input and sets a text block element to the string, I call the function in the form class as the result of clicking a button and that works fine but when I call it in main I get no result. As a side note I have a console.writeline function in main as well that doesn't do anything but I don't know if that's related. For context I'm using Visual studio and if it wasn't obvious I don't have too much experience with coding with classes and frameworks like this. Thanks for any assistance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不熟悉
application.run(f1);
在“运行”之前,您也不应该更改文本吗?它是:
我敢肯定,显示 /初始化另一种表格的方法(我使用的一种)是否会
尝试调试来检查代码在运行时是否有效 /读取?
I'm not familiar with
Application.Run(f1);
also shouldnt you change the text prior to "Running it?"It Being:
A way I'm sure will work (the one I use) with showing / initializing another form would be
Have you tried Debug to check if the code works / was read when running?