DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: plz plz help anyone

Hybrid View

  1. #1
    Join Date
    Feb 2007
    Posts
    3

    Question plz plz help anyone

    I m quite new to vb and i m newly joined a company and the company ask me to make this program.
    I have a notepad file which i given below:

    A1/EXT "BMUWBMRT2G1100/" 614 061025 1132
    RADIO X-CEIVER ADMINISTRATION
    BTS EXTERNAL FAULT

    MO RSITE CLASS
    RXOCF-305 DHKL01 1

    EXTERNAL ALARM
    DOOR ALARM
    LLOP



    A1/EXT "BMUWBMRT2G1100/" 715 070103 1933
    RADIO X-CEIVER ADMINISTRATION
    BTS EXTERNAL FAULT

    MO RSITE CLASS
    RXOCF-320 AHIR01 1

    EXTERNAL ALARM
    DG ON (GS)
    LLOP



    A1/EXT "BMUWBMRT2G1100/" 302 070120 1344
    RADIO X-CEIVER ADMINISTRATION
    BTS EXTERNAL FAULT

    MO RSITE CLASS
    RXOCF-109 MEE117 1

    EXTERNAL ALARM
    DOOR ALARM
    MAINS FAIL


    A1/EXT "BMUWBMRT2G1100/" 207 070129 0559
    RADIO X-CEIVER ADMINISTRATION
    BTS EXTERNAL FAULT

    MO RSITE CLASS
    RXOCF-118 BGPT02_332 1

    EXTERNAL ALARM
    RECTIFIER FAIL



    A1/EXT "BMUWBMRT2G1100/" 091 070130 1447
    RADIO X-CEIVER ADMINISTRATION
    BTS EXTERNAL FAULT

    MO RSITE CLASS
    RXOCF-117 RMRJ01_1472_C 1

    EXTERNAL ALARM
    BATTERY FUSE FAIL
    MAINS FAIL
    DG ON


    A1/EXT "BMUWBMRT2G1100/" 152 070130 1453
    RADIO X-CEIVER ADMINISTRATION
    BTS EXTERNAL FAULT

    MO RSITE CLASS
    RXOCF-248 RIWL01 1

    EXTERNAL ALARM
    DOOR ALARM
    MAINS FAIL (GS)
    DG ON (GS)



    A1/EXT "BMUWBMRT2G1100/" 514 070130 1522
    RADIO X-CEIVER ADMINISTRATION
    BTS EXTERNAL FAULT

    MO RSITE CLASS
    RXOCF-14 MEE32_14_C 1

    EXTERNAL ALARM
    DOOR ALARM
    HIGH TEMPERATURE ( GS )



    A1/EXT "BMUWBMRT2G1100/" 519 070130 1524
    RADIO X-CEIVER ADMINISTRATION
    BTS EXTERNAL FAULT

    MO RSITE CLASS
    RXOCF-506 MEE132 1

    EXTERNAL ALARM
    DOOR ALARM



    A1/EXT "BMUWBMRT2G1100/" 545 070130 1526
    RADIO X-CEIVER ADMINISTRATION
    BTS EXTERNAL FAULT

    MO RSITE CLASS
    RXOCF-81 MEE81 1

    EXTERNAL ALARM
    DOOR ALARM



    A1/EXT "BMUWBMRT2G1100/" 574 070130 1531
    RADIO X-CEIVER ADMINISTRATION
    BTS EXTERNAL FAULT

    MO RSITE CLASS
    RXOCF-250 MEE94 1

    EXTERNAL ALARM
    DOOR ALARM



    A1/EXT "BMUWBMRT2G1100/" 595 070130 1537
    RADIO X-CEIVER ADMINISTRATION
    BTS EXTERNAL FAULT

    MO RSITE CLASS
    RXOCF-377 MEE120 1

    EXTERNAL ALARM
    DOOR ALARM



    A1/EXT "BMUWBMRT2G1100/" 656 070130 1544
    RADIO X-CEIVER ADMINISTRATION
    BTS EXTERNAL FAULT

    MO RSITE CLASS
    RXOCF-326 KAWL01_2411 1

    EXTERNAL ALARM
    DOOR ALARM
    DG ON (GS)



    A1/EXT "BMUWBMRT2G1100/" 657 070130 1544
    RADIO X-CEIVER ADMINISTRATION
    BTS EXTERNAL FAULT

    MO RSITE CLASS
    RXOCF-63 BB01_63_A 1

    EXTERNAL ALARM
    DOOR ALARM
    RECTIFIER MAJOR ALARM
    MAINS FAIL
    DG ON



    A1/EXT "BMUWBMRT2G1100/" 658 070130 1544
    RADIO X-CEIVER ADMINISTRATION
    BTS EXTERNAL FAULT

    MO RSITE CLASS
    RXOCF-11 MEE12_11_C 1

    EXTERNAL ALARM
    BATTERY FUSE FAIL



    A1/EXT "BMUWBMRT2G1100/" 768 070130 1601
    RADIO X-CEIVER ADMINISTRATION
    BTS EXTERNAL FAULT

    MO RSITE CLASS
    RXOCF-161 BHSM01_1474_C 1

    EXTERNAL ALARM
    DOOR ALARM
    MAINS FAIL (GS)
    DG ON ( GS )



    A1/EXT "BMUWBMRT2G1100/" 906 070130 1618
    RADIO X-CEIVER ADMINISTRATION
    BTS EXTERNAL FAULT

    MO RSITE CLASS
    RXOCF-341 MEE101 1

    EXTERNAL ALARM
    DOOR ALARM
    HIGH TEMPERATURE (GS)

    like this we have many fault detail approx. 500 and there is app. 60-70 door open alarm fault there is also many fault detail like dg on and etc.--
    now we r working as, we press ctrl.+f and then find door open and then we note rsite and this rsite we note on a sheet manuaaly.Because we have to send these rsite to a person

    I want that there is a button on V.B. front window and this button is connected to notepad and when we click this button then a new form or sheet will open which contains like below:-
    1)rsite-----door open
    2)rsite-----door open
    3)rsite-----door open

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    The simplest solution is probably to read the entire file into a string array. Then loop through the array, checking each element for "DOOR ALARM". When you find it, move backward through the array looking for "RSITE". Finally, get the rsite value from the next line. Something like this:
    Code:
    Option Explicit
    Sub Main()
    
        Dim I As Integer
        Dim J As Integer
        Dim RSite As String
        Dim Output As String
        Dim Lines() As String
    
        ' Read file into array
        Lines = ReadFile("d:\filename.txt")
        
        ' Loop through array
        For I = 0 To UBound(Lines)
            ' Check line to see if it contains "DOOR ALARM"
            If InStr(Lines(I), "DOOR ALARM") Then
                ' If so, loop backward through array
                ' until "RSITE" is found
                For J = (I - 1) To 0 Step -1
                    If InStr(Lines(J), "RSITE") Then
                        ' Extract Rsite value from next line
                        RSite = GetRSite(Lines(J + 1))
                        ' Add line to output
                        Output = Output & RSite & String$(20 - Len(RSite), ".") & "door open" & vbCrLf
                    End If
                Next
            End If
        Next
        
        ' Output now contains one line for each RSite
        ' with a door alarm. You may display it in a Label,
        ' write it to a file, etc.
    
    End Sub
    
    Function ReadFile(ByVal FileName As String) As String()
    
        Dim hFile As Integer
        Dim Line As String
        Dim LineCount As Integer
        ReDim Lines(100) As String
        
        hFile = FreeFile
        Open FileName For Input As hFile
        Do Until EOF(hFile)
            ' Read a line from the file
            Line Input #hFile, Line
            ' Save line in array
            Lines(LineCount) = Line
            ' Keep track of how many lines we've read
            LineCount = LineCount + 1
            ' If array is full, make room for more lines
            If LineCount = UBound(Lines) Then
                ReDim Preserve Lines(LineCount + 100)
            End If
        ' Repeat
        Loop
        Close hFile
        
        ' Resize array to actual number of lines
        ReDim Preserve Lines(LineCount)
        ReadFile = Lines()
    
    End Function
    
    Function GetRSite(ByVal Line As String) As String
    
        Dim Parts() As String
        
        ' Split line into parts, using space as separator
        Parts = Split(Line)
        ' Return RSite (second part)
        GetRSite = Parts(1)
    
    End Function
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

Similar Threads

  1. Replies: 4
    Last Post: 11-24-2006, 08:25 AM
  2. Plz Urgent!! Its really essential
    By mr06 in forum .NET
    Replies: 2
    Last Post: 06-22-2006, 12:12 PM
  3. plz help me n00b here
    By Apocalyp5e in forum Java
    Replies: 11
    Last Post: 12-22-2005, 09:03 PM
  4. plz plz plz help me(java)
    By kamon in forum Java
    Replies: 4
    Last Post: 08-10-2005, 10:30 AM
  5. java applet... i'm in a fix, plz help
    By nsbscool in forum Java
    Replies: 1
    Last Post: 05-02-2005, 08:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center