'How to display the logged in username with winforms?
This question describes the original problem, though I am working with c++/CLI and not C#.
I've tried writing something equivalent in c++/cli but, to be honest, I'm in a self paced c++ class all by myself with no peers and this project is something I decided to do for fun. There are some things I've yet to fully understand and I don't have peers to discuss this with.
So, I would appreciate an answer to this question A LOT, but I also have other questions specifically related to the answer written in C#. You can stop reading here if you're not interested in answering anything besides my main question.
I rewrote the welcome form constructor like this:
public:
Page(String^ userNAME) {
InitializeComponent();
//not sure about the rest
}
I'm very confused about the property in the login form though. I'm not very experienced with properties or using get/set so I'm not really sure how to start writing this in C++/CLI. This is what I have so far (written in the log in form):
public:
property String^ username{
String^ get() { return textBox1->Text; }
void set(); ////?????
}
In the answer written in C# there's no set accessor. When I just write that I get an error about it having no set accessor. To be honest I'm having a hard time understanding get/set in this context. The explanations online mostly work with integers. Maybe this is completely irrelevant because get/set works differently in C#, but I'm very curious to know (if that isn't the case):
What would I write for set and why?
I'm not experienced on this site at all and most of the questions i've asked have not been received well and i'm trying to improve that. I did my best to ask the actual question and separate things that might be considered XY questions that I'd still really like an answer to.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
