How to Access a txtBox Object from a Program

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
This is the front part of my form

namespace locationBasedAds {

	using namespace System;
	using namespace System::ComponentModel;
	using namespace System::Collections;
	using namespace System::Windows::Forms;
	using namespace System::Data;
	using namespace System::Drawing;

	/// <summary>
	/// Summary for Form1
	///
	/// WARNING: If you change the name of this class, you will need to change the
	///          'Resource File Name' property for the managed resource compiler tool
	///          associated with all .resx files this class depends on.  Otherwise,
	///          the designers will not be able to interact properly with localized
	///          resources associated with this form.
	/// </summary>
	public ref class Form1 : public System::Windows::Forms::Form
	{
	public:
		Form1(void)
		{
			InitializeComponent();
			//
			//TODO: Add the constructor code here
			//
		}

	protected:
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		~Form1()
		{
			if (components)
			{
				delete components;
			}
		}
	private: System::Windows::Forms::Button^  btnTestDownload;
	private: System::Windows::Forms::Button^  cmdUpdateYourLocation;
	private: System::Windows::Forms::Button^  DisplayAllLocation;
	public: System::Windows::Forms::TextBox^  txtDisplay;


As you see, I have set txtDisplay to public

I tried to do locationBasedAds::Form1.txtDisplay.Text and it doesn't work

The intellisense show locationBasedAds::Form1

but is clueless after I press locationBasedAds::Form1
Well say I want to populate txtDisplay. How would I do so?

Also txtDisplay is a pointer isn't it? What the hell is that ^ sign anyway?
Hmm....

locationBasedAds::Form1::txtDisplay->Text seems to work. I wonder why. txtDisplay is not static right?

Oh I get it. Form1 is a type not an instantiation of a class.
Topic archived. No new replies allowed.