Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > General Coding
You last visited: Today at 22:09

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Control Array

Discussion on Control Array within the General Coding forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 2
Join Date: Oct 2006
Posts: 218
Received Thanks: 138
Control Array

Hi, I want to rewrite one of my old projects in VS2008 using the C++ CLR.

It contains alot of Controls like Buttons, Combo Boxes ect... and i want

to create a Control Array for it. I already searched a few hours for a solution,

but i didn't found any 100% working solution.

I have added the following to my constructor code:

Code:
array<System::Windows::Forms::Button^>^test = gcnew array<System::Windows::Forms::Button^>(2);
			test[0] = (gcnew System::Windows::Forms::Button());
			test[0]->Location = System::Drawing::Point(100, 100);
			test[0]->Size = System::Drawing::Size(40, 40);
			test[0]->Text = L"M";
			test[0]->Visible = true;
			this->Controls->Add(test[0]);
So far, it create the button and i can see it. The problem is that Iam not

able to access the Object out of this code, so its some kind of local (if I
try to read informations, the debugger say undeclared variable.....)

Would be nice if someone could help me.

Thats the whole code:

Mankana is offline  
Old 07/10/2009, 20:02   #2

 
x]vIrus[x's Avatar
 
elite*gold: 37
Join Date: Apr 2004
Posts: 2,154
Received Thanks: 250
your problem is that you declare the array in the init of form1,.. so if the init is done, the array is lost, the reference to the button is still in the form, so it wont disappear, if you declare the array out of the funktion, initialize the array in the function, then you can use it anywhere with test[x]->bla

simple example:

Fail:
Code:
void bla() { int blubb = 17; }
void blaa() { blubb=3; }
success:
Code:
int blubb;
void bla() { blubb=17; }
void blaa() { blubb=3; }
x]vIrus[x is offline  
Old 07/10/2009, 20:53   #3
 
elite*gold: 2
Join Date: Oct 2006
Posts: 218
Received Thanks: 138
I already got a work around, just created the specific amount of controls and access them
over the index, but thanks for your answer
Mankana is offline  
Old 07/10/2009, 21:15   #4

 
x]vIrus[x's Avatar
 
elite*gold: 37
Join Date: Apr 2004
Posts: 2,154
Received Thanks: 250
then see it as a future help, since this is the basics of the basics
x]vIrus[x is offline  
Old 07/11/2011, 06:23   #5
 
elite*gold: 0
Join Date: Jul 2011
Posts: 2
Received Thanks: 0
public static BlockCopy(
Array src,
int srcOffset,
Array dst,
int dstOffset,
int count )
suryaprasath is offline  
Reply


Similar Threads Similar Threads
Array-Problem
05/13/2010 - AutoIt - 0 Replies
Also ich habe die System-Zeit und das System-Datum in einen Array geladen: #include <Date.au3> Global $dat, $tim $dat = _NowCalcDate() If @error Then Return $tim = _NowTime(5)
Control Center for Admin Easy to Control all
10/16/2009 - MapleStory - 2 Replies
Credits go to ucyc for making this nice programm http://www.pictureupload.de/originals/pictures/15 1009164127_2.jpg http://www.pictureupload.de/originals/pictures/15 1009164303_3.jpg Download Click here
Array of Bytes
10/02/2009 - Dekaron - 1 Replies
Hi, could someone please post the array of bytes needed for: -Vac -Non-Agro -Speed -Map Hack -Far Eye -Zoom -Auto Pots And if anyone is even more generous, could you PM me the AoB for the skill hacks as well. I don't have much to give back seeing as this is a forum, but i will give you my thanks.
Hilfe mit Array in C#
02/11/2007 - .NET Languages - 3 Replies
Also ich bräuchte mal eure Hilfe. Wir haben als Aufgabenstellung : Ein Array feld mit beliebig vielen zahlen(aufsteigend sortiert) dann sollen wir eine Zahl einlessen und diese wird dann wieder aufsteigend in das array feld rein sotiert.(ganze Zahlen) Also ein bisschen was hab ich schon geschafft naja nicht viel ^^: Also da werden mal die standart Zahlen ausgegeben und die Zahl zum einsotieren eingelessen dann werden die standart Zahlen noch so weit bis sie geordnet werden müssen...



All times are GMT +1. The time now is 22:09.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.