472,784 Members | 1,211 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,784 software developers and data experts.

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 967

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: knocte | last post by:
Hello. I have always thought that the eval() function was very flexible and useful. If I use it, I can define functions at runtime!! However, I have found a case where eval() does not work...
by: aditya | last post by:
Hi all, Can body please me that why the following code in not working as expected.Basically,my aim was to shift the control from one function to another as soon as I presses Control-c keys. In...
by: AK | last post by:
I'm using a .NET Windows Forms Applications project. I'm using LoadLibrary & GetProcAddress to use a DLL function. This is all done in the main cpp file. I would like to use this DLL function in a...
by: Netveloper | last post by:
Hi, I'm playing around with url rewriting and I have come across a problem which I can't seem to get past. The general ide is to have a IHttpHandlerFactory class which checks the incoming...
by: jmdolinger | last post by:
Hi all, I'm a newbie to Atlas (and recently ASP.NET) after coming from a long Java background, also have done quite a bit with an Ajax.NET/ASP.NET 1.1 project, but it was basically all...
by: J MCallister | last post by:
Hello, I am working on a shopping cart where the viewer sees a dropdown with shipping options, each with a price. Elsewhere on the page is a display of the total. I am working on having the...
by: Bruno Rafael Moreira de Barros | last post by:
function test1() { trigger_error('My error'); } application.php //code... test1(); //code...
by: raylopez99 | last post by:
KeyDown won't work KeyPress fails KeyDown not seen inspired by a poster here:http://tinyurl.com/62d97l I found some interesting stuff, which I reproduce below for newbies like me. The main...
by: Plater | last post by:
I'm a bit boggled by this since I am rather new to using reflection. I want to attach an event handler via Reflection (which I can do), but I want to NOT have to know the exact event delegate...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
by: Mushico | last post by:
How to calculate date of retirement from date of birth
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.