My group box is causing problems when searching for a text line in a text file.

I am developing a booking system, so for this I need to ensure that no two clients can book the same appointment slot. So, on testing my code which prevents double booking, the system doesn't seem to find the text line being searched for in the text file
when it (purposefully) should.
I have tried isolating the problem using breakpoints, and I've found that when the 'SearchLine' (referring to my code below) does not include the 'TimeComboBox.text' piece and instead this value is written into the code, the system is able to find the SearchLine
without any problems. But, when assigning the group box's value to a variable and using this in the SearchLine instead, or without even using a loop and just doing a simple line by line search, the program can't find this line of text in the file.
I'm lost for ideas. I have tried everything I can think of. Could anyone make any suggestions as for what is the problem with my group box? (I'll explain the code beneath it).
'Setting the value of the SearchLine (which is a String)
SearchLine = String.Concat(DateTimePicker1.Value.Date & " " & TimeComboBox.text)
Dim FoundApp As Boolean
Dim objReader As New System.IO.StreamReader(basicfilepath & "Text Files\Client Booked Appointment DatesTimes.txt")
FoundApp = False
'Reading the file's contents and checking for the SearchLine
Do While (objReader.Peek() <> -1) or (FoundApp = True)
If (TextLine = SearchLine) Then
'Line contains SearchLine. Appointment already exists.
FoundApp = True
Else
'Line doesn't contain SearchLine. Carry on searching.
Msgbox("Line not found.")
End if
Loop
Explanation
When the line is searched for, the 'FoundApp' value must be set to 'True' when it is found. If it is not found, it remains false.
To isolate the problem, I've displayed the SearchLine in a message box in the past to make sure that the correct line of text is being searched for.
In basic terms, my program is searching for the exact line of text which exists in the text file, but for some reason it is not coming up as 'Found'. The error occurs when the group box's value is used. The text file which is being read is
definitely correct. Please help, any suggestions would be appreciated.
Thank you

Hi
It would appear that your snippet doesn't actually read the file at all.
Here is my test which works fine.
Option Strict On
Option Infer Off
Option Explicit On
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim SearchLine As String = "18:09:38 : XTaskSettings.Load PARAMS: begin"
Dim FoundApp As Boolean = False
Dim TextLine As String = Nothing
Dim objReader As New IO.StreamReader(Application.StartupPath & "\Data\Report Q1.txt")
FoundApp = False
Do While (objReader.Peek() <> -1) Or (FoundApp = True)
' this was missing
TextLine = objReader.ReadLine
If (TextLine = SearchLine) Then
'Line contains SearchLine. Appointment already exists.
FoundApp = True
MsgBox("Line found.")
Else
'Line doesn't contain SearchLine. Carry on searching.
MsgBox("Line not found.")
End If
Loop
End Sub
End Class
Regards Les, Livingston, Scotland

Similar Messages

  • Problems when searching for non-Latin characters

    In my studies I often need to search for Japanese terms. I usually do this from the Smart Search Field to go straight to Google. However, Safari seems not to be able to handle the Japanese characters. For example, I might type 日本 into the Smart Search Field. I would then expect to see results about the country of Japan (for that is what I searched). Instead, I see this: http://puu.sh/1MwvG
    This is pretty much a dealbreaker for me re: Safari. Is there something that will fix it?

    I can't seem to duplicate this.  Are you typing in the same place I am? I see I only have 6.0.1...

  • The following error occured when searching for on-premises exchange server

    I look after a company where I installed a new DELL server last year, The server is running Windows Small Business Server 2011 which we installed. Exchange 2010 was installed as part of the Windows Small Business Server 2011 installation. At the time we
    did not configure Exchange because they use external POP accounts for email. Eventually they wanted to move over to Exchange
    When we created the user accounts using Windows SBS Console, it created a local mailbox for each user
    No problems - [email protected]
    Since late last year every time I create a new user within SBS Console, it errors creating the mailbox
    Add a user account and assign a user role
    Getting "Unexpected error occurred" when Setting up an e-mail account for user
    Looking at the error "Unexpected error occurred" & MessagingManagement "Unexpected error occured"
    The user account is created ok just no e-mail address is created for the user
    I never thought much about this at the time as we weren't using Exchange email accounts. I decided to have a look at this issue over weekend
    When I try to open Microsoft Exchange Management Console I'm getting "Initialization failed"
    The following error occurred when searching for the On-Premises Exchange server
    When I try to open Microsoft Exchange Management Shell, I get a similar error
    I've download & run EMTShooter which just identifies there is an error & gives me the same error
    I've installed & re-installed WinRM IIS Extensions
    I've checked all the settings in IIS, Default Web Site, PowerShell, Modules & Paths...
    Still cannot connect to Exchange
    I've trawled through the internet for two days checking & testing every solution but no luck
    I've checked every setting against another Windows SBS 2011 Server we've installed & works
    I cannot find a difference
    Can someone help me or point me in the right direction?
    Peter Ralphs

    Thanks for the reply Cara
    Here's the original error I was getting when opening Exchange Management Console
    Initialization failed
    The following error ocurred while searching for the on-premises Exchange server:
    [server.myd.local] Connecting to remote server failed with the following error message : The WinRM client cannot process the request. It cannot determine the content type of the HTTP response from the destination computer. The content type is absent or invalid.
    For more information, see the about_Remote_Troubleshooting Help topic. It was running the command 'Discover-ExchangeServer -UseWIA $true -SuppressError $true -CurrentVersion 'Version 14.1 (Build 218.15)
    I got similar error when trying to access the Exchange Management Shell
    VERBOSE: Connecting to SERVER.myd.local
    [server.myd.local] Connecting to remote server failed with the following error message : The WinRM client cannot process the request. It cannot determine the content type of the HTTP response from the destination computer. The content type is absent or invalid.
    For more information, see the about_Remote_Troubleshooting Help topic.
        + CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [],                          
    PSRemotingTransportException
        + FullyQualifiedErrorId : PSSessionOpenFailed
    When I opened the Exchange Management Console this week, the error had changed slightly
    Initialization failed
    The following error ocurred while searching for the on-premises Exchange server:
    [server.myd.local] Connecting to remote server failed with the following error message : The WinRM client received an HTTP server error status (500), but the remote service did not include any other information about the cause of the failure. For more information,
    see the about_Remote_Troubleshooting Help topic. It was running the command 'Discover-ExchangeServer -UseWIA $true -SuppressError $true -CurrentVersion 'Version 14.1 (Build 218.15)
    I could only run Exbpa from a command prompt (obviously no access from Exchange Management Console)
    This is the result of the Health Check Scan
    Organization: First Organization
    Default Global Address List Changed
    The 'msExchQueryFilter' attribute of the default Global Address List 'Default Global Address List' has been changed. Default: '(Alias -ne $null -and (ObjectClass -eq 'user' -or ObjectClass -eq 'contact' -or ObjectClass -eq 'msExchSystemMailbox' -or ObjectClass
    -eq 'msExchDynamicDistributionList' -or ObjectClass -eq 'group' -or ObjectClass - eq 'publicFolder'))'. Current: '((Alias -ne $null) -and (((ObjectClass -eq 'user') -or (ObjectClass -eq 'contact') -or (ObjectClass -eq 'msExchSystemMailbox') -or (ObjectClass
    -eq 'msExchDynamicDistributionList') -or (ObjectClass -eq 'group') -or (ObjectClass -eq 'publicFolder'))))'.
    Admin Group: Exchange Administrative Group (FYDIBOHF23SPDLT)
    The default public folder database is remote
    The default public folder database for mailbox database 'Mailbox Database' on server SERVER isn't local. Public folder database: CN=Public Folder Database 1529293969,CN=Databases,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=First
    Organization,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=myd,DC=local.
    Server: SERVER
    Disk timeout changed
    Disk timeout on server SERVER.myd.local is not set at the default of 10 seconds. This is normal if third-party storage software is installed. Current timeout value is 160 seconds.
    Client RPC binding found
    The 'Rpc_Binding_Order' is set on server SERVER.myd.local. It is possible that either the Exchange or Outlook client is installed on the server. Current registry value: ncalrpc,ncacn_ip_tcp.
    One thing I've noticed from the start is that the error occurs when it is "searching" for the Exchange Server, it then goes on to name the server [server.myd.local] it knows it's there but cannot access it ?
    Another thing I've noticed is that it always refers to the "remote server" this server is Windows SBS 2011, it's the Domain Controller, DHCP Server, DNS Server & Exchange Server all in the same box
    I also noticed that the Health Check stated that "The default public folder database is remote"
    Has this something to do with it ?
    Regards
    Peter

  • Creating new selection criteria when searching for PR

    Hi,
    Need help. i want to add selection criteria when searching for a Purchase Requisition (PR).
    Currently, when u go to ME52N/ME53N, and you click on 'Other Purchase Request' then you click on F4 the following option are only available when searching for some criteria of PR.
    Purchase Requisition per Asset
    Purchase Requisition per Requirement Tracking Number
    Purchase Requisition per Services
    Purchase Requisition per Purchasing Group
    Purchase Requisition per Order
    Purchase Requisition per Cost Center
    Purchase Requisition per Material
    Purchase Requisition per Network
    Purchase Requisition per Project
    Purchase Requisition per Sales Document
    my intention to add option perhaps like :
    Purchase Requisition per Requestor (the one who created the PR)
    Purchase Requition per Short Text
    How can i achieve this? Thanks in advance.
    She

    Hi ,
    Goto OS52. Press F4.
    Enter thedevelopment class as ME.
    Select MBAN, then Enter .
    Click on Included Search Helps.
    You need add your search.
    Explain your requirement to ABAP team . They will help u in updating the search help.
    Regards
    Ramesh Ch

  • Is it just me, or is this NOT how the new iTunes store is supposed to look when searching for a song, TV show, or app?

    Take a look...that's just weird! When searching movies it looks fine, but when searching for songs, TV shows, or apps, this is what you get. Notice all the DI6 and SF6? I mean I know iTunes 11 just came out and all, but THIS kind of surprised me. Wanted to see if I'm the only one seeing this or if others see it too.

    Ok, Apple has fixed it now

  • Can't find my iweb domain file when searching for it in iweb seo tool

    I am trying to get my iweb website recognized by Google. Can't seem to get the google html code to work in html snippet. So am now trying to use the iweb seo tool but can't find my iweb domain file when searching for it in iweb seo tool. My file is in user/library/applicationsupport/iweb/name.sites2
    It shows in the folder but is not active, so I can't choose it.

    The SEO ftp client is not what I'd recommend using. Once you add the metadata to a local copy of the files use a 3rd party ftp client like the free Cyberduck to upload the files. Much more reliable.
    Google does not use keywords for it's searches although other search engines do. Create a test page on your site (leave it out of the navbar) and try adding Google Analytics to it with Wyodor's instructions. If you get it to work then all you need to do is copy and paste the HTML snippet from the test page into your site pages.
    For information on visitors to your site you can also use StatCounter. It records the number of visitors and a lot more: where they are from, what browser used, which page visited and what site/page then came from for just a few. SC is easy to add to the pages as you get the code for your account, put it in an HTML snippet add the snippet to each page. Old Toad's Tutorial #13 - Adding a StatCounter as an HTML Snippet describes how to do it.
    Again use a test page or a separate test site to work out the details before adding to your site pages.

  • Authorization check when searching for transactions

    Hi all,
    We have a requirement to show only those activities for which a user is authorized. A custom authorization object has been maintained and the check in CRMD_ORDER has been extended accordingly. When opening an activity, the check is executed correctly, but when searching for activities, ALL activities are still shown, so the check is not performed at that particular moment. I have tested with standard authorization objects as well, but none of them are taken into account. Does anyone of you know how we can have the authorization check executed before or during the search, so that only those activities are shown, that the user may maintain as well.
    Thanks in advance!
    Regards,
    Joost

    Hello Joost,
    Check if BADI CRM_ORDER_INDEX_BADI could not map your requirement.
    Regards,
    Frédéric

  • Editor: Annoying pop-up for choosing main programs when searching for text

    Hi,
    We're upgrading to ECC60 and are getting frustrated when searching for text in a source code within the ABAP editor.
    For every include contained in the main program you are searching in there is a pop-up asking to choose the main program for that include.
    This can get crazy when searching in a standard SAP program such as SAPMV45A. You'll have to process through 30-40 of these pop-up windows before your search results appear. I each pop-up you have to scroll though dozens of main programs to find the one you are doing the search in.
    Can this be turned of somehow to have the search functionality work as it did in previous version, where the Editor knows that the program you are launching the search from is the main program you want the results from?
    Thanks,
    Peter

    HI Peter
    Please check if program: <b>RPR_ABAP_SOURCE_SCAN</b> can help you...
    Regards
    Eswar

  • Error when searching for entries in secure store

    Hi All,
      I need to assign the certificate in the sender agreement  for signature verification and decrpting. So when i search for entries, i am getting the error as " Error when searching for entries in Secure Store".
    Details of the Error is showing as:
    Service call exception; nested exception is: com.sap.engine.services.webservices.jaxrpc.exceptions.InvalidResponseCodeException: Invalid Response Code: (401) Unauthorized.
    What is the reason for the above error and how to rectify it..?
    Suggest some useful solution
    Regards
    Prakash

    Hi All,
      Can anyone suggest some ways to rectify the error, as i am not able to  find solution for the error in the
    forum.
    Regards
    Prakash

  • TS4147 contact address not visible although data is present when searched for

    I'm trying to view address information on an existing contact record but it is not showing,  When searched for, it returns the relevant record but the data is still not visible.   All contact info has been reduced to just phone no, email and notes.Help!

    Hi Vetsrini,
    Many thanks for offering to help. It has just been solved. It was a typo in the XML of the name of the column.
    Doh! Obvious now that I know!
    - Jenny

  • On iOS 8.3 there is no keyboard shown when searching for contacts on Contacts tab

    I've updated my iPhone 5C to 8.3 and now I can't use the keyboard when searching for a contact from the Phone app. Using the Contacts app the keyboards works well. No 3rd party keyboards were installed. Anybody else having this issue?
    Cheers,
    Tamas.

    Okay, several reboots solved the problem

  • Search for "A word or phrase in the file" in .trc files gives no result

    Hi
    When i Search through Explorer using search for "A word or phrase in the file" in .trc files I get no result.
    Probably because these files are of type "Microsoft Network Monitor Document".
    But I can open them using Notepad, so why can't I search for a word in these files?
    I there another way to search?
    Normally I ofcourse use Visual Admin. but there are a lot of trace files so it would be nice to do this kind of search
    br Peter

    Hi Peter,
    This is a known problem, see http://support.microsoft.com/kb/309173
    An alternative is to use other tools which search even faster than the slow MS search does.
    Hope it helps
    Detlev

  • Searching for a word or phrase in a file on NSS Pool/Volume

    I have encountered a strange issue in that if I search for a word or phrase in a file at any level of the volume, from the root, down to sub folders, I get different results from 2 or more PC's.
    Workstations are all Win XP SP2, Novell Client 4.91 SP4 for Windows
    Server NW 6.5 SP6 with all post SP's installed.
    I have ran a nss /PoolRebuild=POOLNAME and a NSS /VisibilityRebuild=VOLNAME
    There is only one volume on this pool.
    And I still encounter the same results.
    As one example:
    On my Admin workstation When I search the top level Folder of Closed Client folders for the word chronology, I get 2 files returned named chronfile1 and chonfile2, when I search from any other workstation (I have tried 4 different workstations at this point) at the same folder level, for the same word Chronology, I get multiple files with the Word in the File, but I do not see files chronfile1 or chronfile2. Likewise, the file names returned form the search results on the other workstations, are not returned in the search list ran on the admin (Mine) workstation. And yes, I am logged in as admin on the other workstations when running the search.
    So far, this issue is only appearing on 1 volume.
    Thoughts?

    Originally Posted by ataubman
    If you log in to the second PC as Admin, does the symptom move? IOW does it follow the user or the workstation? If the user you may have some odd file system rights set, although your specific results you report are puzzling.
    I'm assuming you are using the Windows desktop search tool?
    I ran a NSS /PoolRebuild last night which fixed an issue the workstations not being able to see the 2 files in question.
    Previous night I had just performed an NSS /PoolVerify.
    Part of the other anomoly, the other workstations seeing more files than the admin workstation (I feel so Stupid, after 25 years you think I'd be able to spot the obvious) the reason the other workstations were returning files that the Admin workstation was not - Admin workstation doesn't have Word Perfect installed.
    Somebody, give me a Gibbs head slap, now!

  • Search for a String in a list of files

    Could anyone please send me a java sample code which searches for a string from a list of files and returns me the filename and the line in which the Search String was found ?
    Thanks in advance
    RR

    Simple solution would be -
    1. Traverse a directory for each file.
    2. Read each file using Buffered Reader.
    3. Use readLine() method to read a line.
    4. Use String.indexOf to see if the data which you are looking for is there in the line or not.
    5. If its there then store the line number and file name.
    6. When the loop will end you will have list of file name and line number where the data which you are looking for is present.

  • Parallelized for loop. Searching for a one-line solution

    Hi.
    In an usual day I do a lot of for loops inside of command line. But I noted that my loops don't use the full power of my dual core processor, they only use one processor.
    A lot of the loops I do have independent interactions in the sense that a interaction code don't need the results of another interaction. This is the simplest problem in multiprocessing, I only need to execute N process in parallel.
    I'm searching for a one-line solution that I can use in place of a 'for i in *.txt; do echo $i;done'. With one-line I means that can be used as one-line but the implementation can be longer. And can be in any programming language.
    For now I'm using the following small python solution (the smallest I could get)
    #!/usr/bin/env python
    # -*- coding: utf-8 -*-
    from multiprocessing import Pool
    from glob import glob
    from subprocess import call
    def f(x):
    call(['asy', '-f', 'png', '-render=0', x])
    pool = Pool(processes=4)
    pool.map(f, glob('*.asy'))
    But I like something that can be integrated in my "shell life". Anyone know a solution for my problem?

    http://stackoverflow.com/questions/3816 … ash-script
    http://www.mail-archive.com/bug-bash@gn … 05820.html
    Last edited by karol (2009-11-23 00:30:34)

Maybe you are looking for

  • Adobe Muse (2014.3) "Add Web Font" Function Not Working As Expected - Newly Added Fonts Become Unavailable Though Shown

    Hello. This has also been posted in the Community: Adobe Muse Bugs forum. I've been having some odd/irregular issues though they have now become fairly predictable in nature. The issue is in regards to Adobe Muse (2014.3) and the availability of web

  • SXMB_Moni

    If there is a document to understand the details about the lists that are shown in the SXMB_Moni? i.e once you open a job there are many items listed like Receiver Grouping, Request Message Mapping, Technical Routing, Call Adapter, Response. Under Re

  • Does java has problem storing floating point numbers?

    Hi just a quick question. I have been programming in java at least 4, 5 year by now and I feel rather comfortable with programming in java. However, just other day I hit problem with java which I was hoping someone on this forum can fill in for me. N

  • Execute package task is not able to pickup the package to execute it from a Foreach Loop Container

    Hi, I want to execute 5 packages using EXECUTE PACKAGE Task in FOR EACH LOOP Container. I followed the instructions as per the below link http://microsoft-ssis.blogspot.in/2013/01/master-child-packages-part-1-file-based.html When I execute the main p

  • Manage Payroll Methods Error

    Hello, When attempting to use manage payroll methods in SSHR I come across the following errors. I am working on 11i and do not have all of my pay methods set up. I have set up some mock pay methods (direct deposit and check) but I am not sure why I