问题描述
我是一位旧的VB6桌面表单应用程序人员.我正在尝试自学C#,并同时升级大型的Multi-Company-VB6桌面应用程序.我正在使用Visual Studio 2015和最新版本的.Net
I am an Old VB6 desktop forms application guy. I am trying to teach myself C# and upgrade a large, Multi-Company VB6 desktop app at the same time. I am using Visual Studio 2015 and the latest version of .Net
我的每个表单都有一个Text属性.一旦用户选择了要使用的公司数据集,并显示了登录表单,我想在FormLogin.Text属性的选择表单公司"中显示他们选择的特定公司的名称.我有 尝试了以下代码:
Each of my forms has a Text property. Once a user selects a company data set to use, and l display the login form I would like to display the Name of the particular company they selected in the Select form Company in the FormLogin.Text property. I have tried the following code:
using System.Data.SqlClient;
using System.Windows.Forms;
using OnTarget9.DataClasses;
// Created By Ed Aymami
// Date Created : 12/29/2016
// Purpose : Allows User to enter login name and password to gain access to the program
namespace OnTarget9.FileForms
{
public partial class UserLogin : Telerik.WinControls.UI.RadForm
{
public UserLogin()
{
InitializeComponent();
if (MyGlobals.CurrentCompany.CurrentCompanyName != "")
{
this.Text = "User Login " + MyGlobals.CurrentCompany.CurrentCompanyName;
}
}
// More processing follows...
}
如果我只是设置"this.Text ="用户登录Hooptie",然后FormTitle.Text显示"User Login Hooptie".
If I just set "this.Text = "User Login Hooptie " then the FormTitle.Text displays "User Login Hooptie ".
如果有人可以解释为什么我添加一个变量"后,它不会改变呢?到字符串,请让我知道.
If anyone can explain why it won't change if I add a "variable" to the string Please let me know.
长颈鹿是由委员会设计的马.
A giraffe is a horse designed by a committee.
推荐答案
https://en.wikipedia.org/wiki/关注的问题
https://en.wikipedia.org/wiki/Separation_of_concerns
http://www.blackwasp.co.uk/csharpobjectdirectional.aspx
http://www.blackwasp.co.uk/csharpobjectoriented.aspx
http://www.dofactory.com/net/design-patterns
http://www.dofactory.com/net/design-patterns
https://www.codeproject.com/articles/228214/understanding-basics-of-ui-design-pattern-mvc-mvp
https://www.codeproject.com/articles/228214/understanding-basics-of-ui-design-pattern-mvc-mvp
https://www.codeproject.com/Articles/383153/The-Model-View-Controller-MVC-Pattern-with-Csharp
https://www.codeproject.com/Articles/383153/The-Model-View-Controller-MVC-Pattern-with-Csharp
https://www.codeproject.com/Articles/14660/WinForms-Model-View-Presenter
https://www.codeproject.com/Articles/14660/WinForms-Model-View-Presenter
https://msdn.microsoft.com/zh-cn/library/bb384398.aspx?f=255&MSPPError=-2147217396
https://msdn.microsoft.com/en-us/library/bb384398.aspx?f=255&MSPPError=-2147217396
https://www.codeproject.com/articles/36847/three-layer-architecture-in-c-net
https://www.codeproject.com/articles/36847/three-layer-architecture-in-c-net
VB6 COM和任何.NET语言C#,VB.NET或任何其他.NET语言,并且有许多.NET语言,这是两种不同的开发平台.因此,不要像对待基于COM的解决方案那样对待.NET解决方案,也不要像在做VB6 发展.
VB6 COM and any .NET language C#, VB.NET or any other .NET language, and there are many .NET languages, are two different development platforms. So don't treat a .NET solution like it some COM based solution or like you are doing VB6 development.
仅供参考. :)
这篇关于学习C#之后,我可以使用一些帮助(指向正确的方向)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!