Quick Question Visual C#, Calling a Fuction from a Class...

Hey guys! New to Programmers Heaven and Hope to stick around! Im not new to programming tho, Im good with Visual Basic.net, AutoITV3 and .LUA. But Im very new to C# and I HAVE to learn it now because Im taking a college coarse on it! So Im in need of a little help , I know this is a easy question for those who know C# because If I was asked to do it in AutoIT or .net It would be no problem! lol

But anyway! Heres my question! I got A form with 2 buttons and some Radio buttons, and 3 classes. I need to be able to call the function 'TRACK_BASE" that is defined in the "Memory.cs" class.. SO how do i call it from the Memory class? Because when I access the "button1" code and put"
}
TRACK_BASE;
{
It says function not defined in this context... Which means i need to call it from the class that its defined in. So can someone please help with this? Thanks alot!

Note: Im using Visual Studio 2008(C#)
I also plan of Contributing by Helping others with my knowledge of the programming languages im more fimilar with!

Comments

  • if the Memory class is already a part of your project, and is static:
    you can :
    {
    Memory.TRACE_BASE(...);
    }
    if it s Dynamic, you have to create the object :

    {
    Memory m = new Memory(...); // construction choice
    m.TRACE_BASE(...);
    }
    : Hey guys! New to Programmers Heaven and Hope to stick around! Im not
    : new to programming tho, Im good with Visual Basic.net, AutoITV3 and
    : .LUA. But Im very new to C# and I HAVE to learn it now because Im
    : taking a college coarse on it! So Im in need of a little help , I
    : know this is a easy question for those who know C# because If I was
    : asked to do it in AutoIT or .net It would be no problem! lol
    :
    : But anyway! Heres my question! I got A form with 2 buttons and some
    : Radio buttons, and 3 classes. I need to be able to call the function
    : 'TRACK_BASE" that is defined in the "Memory.cs" class.. SO how do i
    : call it from the Memory class? Because when I access the "button1"
    : code and put"
    : }
    : TRACK_BASE;
    : {
    : It says function not defined in this context... Which means i need
    : to call it from the class that its defined in. So can someone please
    : help with this? Thanks alot!
    :
    : Note: Im using Visual Studio 2008(C#)
    : I also plan of Contributing by Helping others with my knowledge of
    : the programming languages im more fimilar with!
    :
  • You'll also need to make sure that, if the Memory class is in a different namespace from the form, you either have a "using" statement in the form class providing a reference to the namespace of the Memory class, or instantiate the Memory class explicitly using its full path.

    If the form is only using the Memory class once it might save a bit on memory usage at run time using the latter method.

    I assume, if you're familiar with VB.NET, that you understand the concept of namespaces and static classes etc?

    : if the Memory class is already a part of your project, and is static:
    : you can :
    : {
    : Memory.TRACE_BASE(...);
    : }
    : if it s Dynamic, you have to create the object :
    :
    : {
    : Memory m = new Memory(...); // construction choice
    : m.TRACE_BASE(...);
    : }
    : : Hey guys! New to Programmers Heaven and Hope to stick around! Im not
    : : new to programming tho, Im good with Visual Basic.net, AutoITV3 and
    : : .LUA. But Im very new to C# and I HAVE to learn it now because Im
    : : taking a college coarse on it! So Im in need of a little help , I
    : : know this is a easy question for those who know C# because If I was
    : : asked to do it in AutoIT or .net It would be no problem! lol
    : :
    : : But anyway! Heres my question! I got A form with 2 buttons and some
    : : Radio buttons, and 3 classes. I need to be able to call the function
    : : 'TRACK_BASE" that is defined in the "Memory.cs" class.. SO how do i
    : : call it from the Memory class? Because when I access the "button1"
    : : code and put"
    : : }
    : : TRACK_BASE;
    : : {
    : : It says function not defined in this context... Which means i need
    : : to call it from the class that its defined in. So can someone please
    : : help with this? Thanks alot!
    : :
    : : Note: Im using Visual Studio 2008(C#)
    : : I also plan of Contributing by Helping others with my knowledge of
    : : the programming languages im more fimilar with!
    : :
    :

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories