473,612 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Inser Date & Time to a logfile

3 New Member
Hi Guys,

Complete newbvie here, trying to get an answer to my problem.

I have written small client / server applications, in which everything that the server does is recorded in a logfile using the MY.Computer.Fil esystem string.
I can write the statement to the file and create a new liine for example.

Server Activity - Server Started
Client Activity
Client Activity - User Smith has succesfully logged in
Client Activity - User Smith has logged off
Server Activity - Server Shutdown.

I want to add the date and time of each event before the activity statment line

TIA
Dec 7 '06 #1
3 1324
sashi
1,754 Recognized Expert Top Contributor
Hi Guys,

Complete newbvie here, trying to get an answer to my problem.

I have written small client / server applications, in which everything that the server does is recorded in a logfile using the MY.Computer.Fil esystem string.
I can write the statement to the file and create a new liine for example.

Server Activity - Server Started
Client Activity
Client Activity - User Smith has succesfully logged in
Client Activity - User Smith has logged off
Server Activity - Server Shutdown.

I want to add the date and time of each event before the activity statment line

TIA
Hi there,

Kindly include the below code segment to begining of the activity statement, hope it helps. Good luck & Take care.

Expand|Select|Wrap|Line Numbers
  1.   Now() & "..your activity statement line.."
  2.  
Dec 7 '06 #2
Swordfish Dundee
3 New Member
Sorry, for late reply, but just back from UNI. Worked a treat. Thanks

I've only been doing VB.Net for 6 weeks and hve no real programming skills at all (I am a network man at heart!!)

One last thing, I am atempting to output the contents of a txt file in a display box. The file when open in windows lokos like this

01/01/01 00:00 SERVER ACTIVITY - Server Started
01/01/01 00:00 CLIENT ACTIVITY - User SMITH has logged on
etc
etc

Yet when it displays in the lsbox (named lsLog), there are no carriage returns and all the data is in one very long line.

Code

Private Sub btShowlog_Click (ByVal sender As System.Object, ByVal e As System.EventArg s) Handles btShowlog.Click
Dim fileContents As String
lsLog.Visible = True
lsLog.Items.Cle ar()
btcloselog.Visi ble = True
fileContents = My.Computer.Fil eSystem.ReadAll Text(File_Path & "atmlog.txt ")
lsLog.Items.Add (fileContents)
End Sub

Again any help would be greatfully appreciated
Dec 7 '06 #3
Killer42
8,435 Recognized Expert Expert
You might need to check the delimiters you have on the end of each line. The likely options are:
  • Carriage Return (CR)
  • Line Feed (LF)
  • Both CR & LF
A lot of languages/controls in the Windows world expect CRLF to delimit lines. You might need to either modify the way you write the lines to the file to produce the correct delimiter, or read it line by line to place it in your display field.

You might also want to check whether the control in which you're displaying the text has somethig equivalent to the VB6 textbox's MultiLine property, which determines whether it can show more than one line.
Dec 7 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
2272
by: Gerry | last post by:
As I'm not a PHP-prgrammer at all, I just need Help with this: I have had a guestbook-page in Europe and will now have to move it to a US based-server. This makes the time-function showing time 6 hours wrong. The time should be GMT minus 6 hours. Can anyone help me with that? Her's the code: <?php header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache");
1
1423
by: Lynn.Tilby | last post by:
I am running an experimental system, my disk filled up when running a table build from a query. I mistakenly blew away the files in .../pgsql/data/base/18773 & ../pgsql/data/pg_xlog with NO BU! Recover is only bringing back 8 of about 90 files. I can rebuild the DB from scratch relatively easily... I was going to try and just do a drop database but I get this when trying to bring up the postmaster.
1
1515
by: John | last post by:
Hi I am using and access datetime field to store both date & time. How can I split it into date & time after reading the field and then combine the date & time back into datetime when storing it? Thanks Regards
3
3083
by: divya | last post by:
Hi, I have a table tblbwday with 2 fields Name and Birthday.I have written this script for displaying evryday names of the people on that day. <% set objConn =server.createobject("ADODB.connection") objConn.open "DSN=Photo" Dim sqlSELsite,ObjRSSel sqlSELsite = "SELECT Name FROM tblbwday WHERE B'day ="& date() &" " '
1
4135
by: aRTx | last post by:
<? /* Directory Listing Script - Version 2 ==================================== Script Author: Artani <artan_p@msn.com>. www.artxcenter.com REQUIREMENTS ============ This script requires PHP and GD2 if you wish to use the
1
1838
by: adeebraza | last post by:
Hi, Every Body Following is code for Showing Actual Date & Time on the form and also record Date & Time of an event. See the following and use Call Modified when you want to record an event in your program. Option Explicit Dim Dt, Tm ' Timer set interval=1000 Private Sub Timer1_Timer()
2
2690
by: alivip | last post by:
when I wont to inser (anyting I print) to the textbox it will not inser it just print then hanging # a look at the Tkinter Text widget # use ctrl+c to copy, ctrl+x to cut selected text, # ctrl+v to paste, and ctrl+/ to select all # count words in a text and show the first ten items # by decreasing frequency
3
5175
by: aRTx | last post by:
I have try a couple of time but does not work for me My files everytime are sortet by NAME. I want to Sort my files by Date-desc. Can anyone help me to do it? The Script <? /* ORIGJINALI
3
1140
by: santosh95808 | last post by:
Hi friends, I am finding some difficulties in the inserting date time into the database. I am not able to convert the datetime into the mysql's Date Time format i.e. 'yyyy/mm/dd hh:mm:ss' pls anybody can help me
0
8105
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8565
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
8246
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
8415
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7039
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...
1
6076
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4109
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2550
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
0
1413
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.