Novo

Forum kao aplikacija na telefonu

Dodajte forum na početni ekran i koristite ga kao aplikaciju, sa menijem na dnu ekrana.

Convert::ChangeType i VC++

Convert::ChangeType i VC++ 11.09.2004. u 18:00 · pre 270 meseci #1
Pozdrav svima.

Imam problem kod koriscenja Convert::ChangeType

Imam treeView sa nekoliko Node-ova. Svake node treba da ima neke dodatne informacije koje sam smestio u Tag svojstvo:
Code:

public: ref struct Files
             {
        System::String FullName;
        System::String Note;
    };
...
System::Windows::Forms::TreeNode t;
t=this->treeView1->Nodes->Add("Ime");
Files info;
info->FullName="FullName";
t->Tag=info;
//do sada sve radi OK


E problem nastaje kada iz Tag svojstva hocu da uzemem FullName?
Probao sam sa ChangeType ali nema pojma, gledao sam po netu i opet nista..

Da li neko ima neku ideju?
HVALA>
Potpis
Hide me away from danger
Re: Convert::ChangeType i VC++ 11.09.2004. u 18:39 · pre 270 meseci #2
Code:
//t je tipa Node*

String* tag = __try_cast<String*>(Convert::ChangeType(t->Tag, __typeof(String)));

Ne poznajem bas najbolje managed VC++, pa ako neko ima nesto da doda, neka me isparavi.
Potpis
If it's a girl then they're gonna call it Sigourney, after an actress. If it's a boy, then they're gonna call it Rodney, after Dave!
Re: Convert::ChangeType i VC++ 16.09.2004. u 10:47 · pre 270 meseci #3
probao sam, ali pri kompajliranju dobijam gresku:
"error C4980: '__try_cast' : use of this keyword requires /clr:oldSyntax command line option" ?>?>?
Potpis
Hide me away from danger
Re: Convert::ChangeType i VC++ 16.09.2004. u 12:25 · pre 270 meseci #4
Koji VS ti koristis? Da nije mozda VC++ 2005 Express Beta (posto vidim da imas instaliranu beta verziju Framework-a 2.0)? Meni u VS.NET 2003 to ne prijavljuje i sve odradi korektno.
Potpis
If it's a girl then they're gonna call it Sigourney, after an actress. If it's a boy, then they're gonna call it Rodney, after Dave!
Prijavite se da biste odgovorili u ovoj temi.PrijavaRegistracija

Premeštanje teme