vb8
-
Wednesday, October 13, 2010 2:18 PM
Hi all,
I have a text file named alarm.txt which is 8mb,the sample is as follows.
I need a vb8 program to manually load the text file by clicking a button & searh for text which is displayed in eg as bold & display the output in excel file
for eg:
HQ1MSS01 CMM-1 2010-06-17 03:28:35.93 2185 ROUTING OF OSI OUTGOING CALL FAILED
=========================================================
A small part of alarm.txt file
=========================================================
HQ1MSS01 CMM-1 SWITCH 2010-06-17 03:28:35.93
** ALARM ........ O7AMAN
(0002) 2185 ROUTING OF OSI OUTGOING CALL FAILED
OMC000000D1??? 0003HQ1MSS01 CMU-0 SWITCH 2010-06-17 03:30:37.03
** ALARM CMU-0 1A004-07 CRM_SJ
(0005) 2596 SCCP REGISTRATION ERROR
08 FB FF EBHQ1MSS01 SIGU-8 SWITCH 2010-07-26 12:56:15.54
** ALARM ........ MTA_IX
(1797) 2646 PROTOCOL ROUTING FAILURE
02 07 06 00 0F 97 47 90 02 53 13 86 26 1F FFHQ1MSS01 SIGU-8 SWITCH 2010-07-26 12:58:55.24
** ALARM ........ MTA_IX
(1805) 2646 PROTOCOL ROUTING FAILURE
02 01 08 00 0A 91 96 59 60 00 30 FF FF FF FFHQ1MSS01 SIGU-16 SWITCH 2010-07-26 12:57:33.18
** ALARM ........ MTA_IX
(1801) 2646 PROTOCOL ROUTING FAILURE
02 01 08 00 08 91 96 52 22 22 FF FF FF FF FFHQ1MSS01 SIGU-22 SWITCH 2010-07-26 12:59:49.14
** ALARM ........ MTA_IX
(1806) 2646 PROTOCOL ROUTING FAILURE
02 01 06 00 0F 97 91 98 21 01 14 14 04 8F FFHQ1MSS01 SIGU-15 SWITCH 2010-07-26 12:55:55.27
** ALARM ........ MTA_IX
(1795) 2646 PROTOCOL ROUTING FAILURE
02 01 08 00 0A 91 96 59 60 00 30 FF FF FF FFHQ1MSS01 SIGU-21 SWITCH 2010-07-26 13:03:31.20
** ALARM ........ MTA_IX
(1816) 2646 PROTOCOL ROUTING FAILURE
02 01 06 00 08 A1 97 06 60 38 FF FF FF FF FFHQ1MSS01 STU-1 SWITCH 2010-08-09 02:59:32.16
** ALARM STU-1 1A001-07 FRG_SX
(2371) 2799 FRAUD REPORTING NOT SUCCESSFUL
05 115dHQ1MSS01 SIGU-3 SWITCH 2010-07-26 12:55:43.96
** ALARM ........ MTA_IX
(1793) 2646 PROTOCOL ROUTING FAILURE
02 01 06 00 0A A1 97 05 84 55 85 FF FF FF FFHQ1MSS01 SIGU-1 SWITCH 2010-07-26 12:55:24.02
** ALARM ........ MTA_IX
(1792) 2646 PROTOCOL ROUTING FAILURE
02 01 08 00 08 91 96 52 22 22 FF FF FF FF FFHQ1MSS01 SIGU-21 SWITCH 2010-07-29 11:56:23.33
** ALARM SIGU-21 1C002-10 SEGPRO
(2069) 2254 SCCP NOT DEFINED FOR NETWORK
09 08 00000046 08 FFFFFFFF 08 0000HQ1MSS01 SIGU-17 SWITCH 2010-07-26 12:55:44.85
** ALARM ........ MTA_IX
(1794) 2646 PROTOCOL ROUTING FAILURE
02 01 08 00 08 91 96 52 22 22 FF FF FF FF FFHQ1MSS01 BSU-1 SWITCH 2010-09-22 03:01:10.73
** ALARM BSU-1 1A005-00 URQPRB
(8029) 3263 CALL ESTABLISHMENT FAILURE IN USER PLANE CONTROL
02 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00HQ1MSS01 SIGU-22 SWITCH 2010-07-26 12:55:56.17
** ALARM ........ MTA_IX
(1796) 2646 PROTOCOL ROUTING FAILURE
02 01 08 00 08 91 96 52 22 22 FF FF FF FF FFHQ1MSS01 BSU-5 SWITCH 2010-09-06 21:09:57.33
** ALARM BSU-5 1B002-10 URQPRB
(5973) 3263 CALL ESTABLISHMENT FAILURE IN USER PLANE CONTROL
07 00 07 00 00 00 05 FF FF 00 00 00 00 00 00 00
All Replies
-
Wednesday, October 13, 2010 4:52 PM
You need to know how read text file, there are many methods for that but try this link http://www.builderau.com.au/program/windows/soa/Reading-and-writing-text-files-with-VB-NET/0,339024644,320267367,00.htm
After that, to save the file to excel, you can use excel automation in vb.net, below is link to sample tutorial http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/df02c6d2-e1b5-4731-bb04-2674aed789de
Don't expect someone to write the full code for you, try to do the file reading first before the excel automation. Feel free to ask question when you got stuck
kaymaf
CODE CONVERTER SITE
- Marked As Answer by Liliane TengModerator Wednesday, October 20, 2010 7:33 AM
-
Thursday, October 14, 2010 3:02 AM
You can read the text file into an array of lines.
If you then work through the array in sequence, you can detect when a line starts with "**", which seems to be the indicator for a record, or possibly use "** ALARM".
The data you need will come from the line before and the line following - if you are working through the array using an index counter then Counter - 1 gives you the index of the line before and Counter + 1 gives you the index of the following line.
For each of those lines, use the String Split function with a space separator to get access to the parts of the line in a string array.
Select the parts that you want to use from those string arrays, and put them back together into a single line of text using string concatenation. If you use the Tab character as the delimiter, then you can write the text to a file with extension CSV, and Excel will load it into a spreadsheet.
If you want to push the fields into an existing Excel spreadsheet item by item, you will need to investigate Excel Automation.
- Marked As Answer by Liliane TengModerator Wednesday, October 20, 2010 7:34 AM
-
Thursday, October 14, 2010 7:12 AM
Are you sure it is VB8 (Visual Basic 2005)
With Visual Basic '98 was mostly used the Visual Basic language version VB6.
Currently it happens that '10 is the same as language version 10.
But VB2008 is for instance VB9
Beside those there has also be VB7 (2002) and VB7.1 (2003)
The marketing guys from Microsoft are real with the top in the world by giving their products not understandable names.
Success
Cor

