Ok, I know that might be something easy, but that's my first time with Visual Studio C++ (2008) and I'm a bit lost here.

I'm working with a Windows Form (CLR) and there I have the button: Connect.
If the user press it, then the program should call the function connectsock(), to do the socket connection.

The program creates this Form1.h and myprogram.cpp. If I press the button twice in the form interface, its code is automatically generated, right?

So now comes my question:

where should I call the function connectsock()?
I thought I should call the fuction in myprogramm.cpp, and maybe put a condition: if(button1-> enabled) then call connectsock(). But it doesnt recognize the button1, although form1.h is included here.

If I try to call it direct from the button1_Click function, then it doenst work either. And actually I think it would make more sense to call it from the .cpp file, cause afterwards I will use there the result from it.

Can anybody tell my how to do this?

Thanks in advance!