469,600 Members | 2,281 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,600 developers. It's quick & easy.

Using regular code inside handler function

Hi Everybody,

I would appreciate it if you can give me a hand here.

I want to use the two codes, below, together to do the following
when the "IN" button is clicked (InBtn_Click):-

1- Create (or open) output.txt, and
2- Type the current time (hour only) in it.

I tried to include the first code inside the handle function in the second
code, but it does not work. Can anybody tell me who I am going to work the
two codes together?

Each code works fine by itself. The message box inside the
handler works fine when "IN" button is clicked. The the output.txt file
open and the current time will be stamped inside it when I use it in a
different function. But if I put the first code inside the handler function
of the second code, then, when I click the "IN" button, I would not get what
I am expecting, Which is to open output.txt and stamp the current time.

First code:

FileStream* fs = new FileStream(S"output.txt", FileMode::Create);
StreamWriter* sw = new StreamWriter(fs);
String* TimeString = System::DateTime::Now.ToString("HH");

Second Code:

private: System::Void InBtn_Click(System::Object * sender,
System::EventArgs * e)

// If I put the first code here, output.txt would not be created and current
//would not be stamped.

if ( mark == '-')
MessageBox::Show(" You can't sign in twice! ",S" Error ");

Dec 2 '07 #1
0 886

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by aditya | last post: by
reply views Thread by Netveloper | last post: by
1 post views Thread by jmdolinger | last post: by
4 posts views Thread by J MCallister | last post: by
5 posts views Thread by Bruno Rafael Moreira de Barros | last post: by
14 posts views Thread by raylopez99 | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.