modifying control properties

when I create a simple form application project in vc++ express

I have these two files created by default,

form1.h & project_name.cpp

now suppose i add a text box in form1

I'm not able to change the properties like text of this textbox from anywhere else other then form1.h (say if i want to change properties from this file project_name.cpp)

its a very basic doubt but I've done evrything from making textbox public to anything wierd possible :(

please help.. !!
I found VB really easier & faster to use then vc++ :((

tia
--







Answer this question

modifying control properties

  • Justin Pinnix MSFT

    i wrote this in FLD.cpp

    e1a = System::Convert::ToDouble(Form1->textBox1->Text);

    this is the error which i'm getting..

    error C2819: type 'FLD::Form1' does not have an overloaded member 'operator ->'
    e:\btp\copy of fld\fld\fld\Form1.h(35) : see declaration of 'FLD::Form1'
    .\FLD.cpp(168) : error C2232: '->FLD::Form1::textBox1' : left operand has 'class' type
    .\FLD.cpp(168) : error C2227: left of '->Text' must point to class/struct/union/generic type


  • Olafdebree

    Can you give some more code, I mean line that doesn't compile



  • Gudge

    hi

    thanks for replying, but i aleady tried what you said. It gives me this error

    left of '->Text' must point to class/struct/union/generic type

    This is just an example I gave, I've to continously change properties of controls according to some conditions..so cant put all of them in form.


  • m_vspg

    FormType^ Form1;

    Is your Form1 declared as this (do you access object) Or Form1 is a type (or you access a class)



  • Uluru

    Hi!

     

    All right here. Your form contains control, i.e. have pointer to control object. So form can query it's properties. If you want other part of the code to have access to textbox - provide them this pointer. Something like this: form1->textBox1.Text (textBox1 must be public).

    I think if you making simply program, then you simply can put your logic into form. Why you need put this stuff into other file

     

    P. S. I think you should try C#, this is easier and more natural to .NET than C++ (C++ still have good things, but C# is native .NET language).



  • Alpicus

    ya i got it now... thanks a lot :)


  • modifying control properties