Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to use file I/o codes with form and controls codes

Reply
Thread Tools

How to use file I/o codes with form and controls codes

 
 
Allen
Guest
Posts: n/a
 
      12-02-2007

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:ateTime::Now.ToString("HH");
sw->WriteLine(TimeString);
sw->Flush();
sw->Close();

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
time
//would not be stamped.

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


--
Thanks
Allen

--
Thanks
Allen

--
Thanks
Allen

 
Reply With Quote
 
 
 
 
Mark Rae [MVP]
Guest
Posts: n/a
 
      12-03-2007
"Allen" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> MessageBox::Show(" You can't sign in twice! ",S" Error ");



This appears to be a C++ WinForms app...


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Using Asp.net web form and controls .vs html form and inputs Ellie ASP .Net 2 10-30-2008 01:04 PM
how to write codes to connect access database using html codes hiralcp Software 0 12-18-2007 08:49 PM
Virtual Key Codes, Scan Codes and ASCII Codes in C gj_williams2000@yahoo.co.uk C Programming 2 08-20-2005 11:04 AM
RegEx replace of html codes to ascii codes Greg -- ASP .Net 4 08-09-2005 07:27 PM



Advertisments