June 9th, 2009, 11:32 AM
button programming questions...
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!
June 9th, 2009, 12:43 PM
Re: button programming questions...
You are supposed to call connectsock in the event handler of your button (most probably in CPP file). There is no need to check for button enable state, since user has clicked when it is enabled and thus program control reaches at that point.
Make sure that 'button1' is correct variable name.
You should ask CLI/CLI/MC++ related questions in appropriate forum. This is core VC++ forum, where you may not get proper answes.
Tags for this Thread
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!