Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / December 2007

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Allen - 02 Dec 2007 23:01 GMT
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");
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 ");
 }
}

Signature

Thanks
Allen

--
Thanks
Allen

--
Thanks
Allen

Mark Rae [MVP] - 03 Dec 2007 00:04 GMT
> MessageBox::Show(" You can't sign in twice! ",S" Error ");

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

Signature

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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.