473,657 Members | 2,801 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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"ou tput.txt", FileMode::Creat e);
StreamWriter* sw = new StreamWriter(fs );
String* TimeString = System::DateTim e::Now.ToString ("HH");
sw->WriteLine(Time String);
sw->Flush();
sw->Close();

Second Code:

private: System::Void InBtn_Click(Sys tem::Object * sender,
System::EventAr gs * e)
{

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

if ( mark == '-')
{
MessageBox::Sho w(" You can't sign in twice! ",S" Error ");
}
}
--
Thanks
Allen

Dec 2 '07 #1
0 990

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

Similar topics

12
3433
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 properly. It works, for example, when invoking functions (alert('hello')), but not for defining functions. The case occurs when retrieving the javascript code with
8
1440
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 other words,I was expecting the program to execute in the following way- 1. Initially,the control is in the while loop of the main function.
3
1889
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 .h file. So I code : (Proc2) (0x378, 12)....... (where Proc2 is the function) I get a compiler error : C2065 : 'Proc2' : undeclared identifier. I'm guessing I'm not calling this function properly - how can I fix this problem ? When I write a...
0
1947
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 request url against a set of predefined rules and creates and return the appropriate IHttpHandler implementation. Inside the IHttpHandler implementations, the request is examined and
1
3522
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 javascript, nothing really having to do with ASP.NET... I'm attempting to put together an application that consists of several GridView controls each bound to some xml data. Each table exists in its own update panel. The two effects I'm going for are:
4
5250
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 dropdown update the total when a different option is selected. So far I have it worked out doing it this way:
5
2638
by: Bruno Rafael Moreira de Barros | last post by:
function test1() { trigger_error('My error'); } application.php //code... test1(); //code...
14
2960
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 reason you would want to do this is for example to trigger something from an OnPaint event without resorting to boolean switches-- say if a user presses the "M" key while the program is Painting, the user gets the PaintHandler to do something else. ...
10
9563
Plater
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 signature. For an exmaple, I have a .DLL with the following: public delegate CustomEnum CustomEventHandler(Socket s, CustomClass c); public class myclass { public event CustomEventHandler MyEvent; //...
0
8833
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8737
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8509
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7345
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5636
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4327
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2735
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1967
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.