Click here to Skip to main content
15,890,897 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: bindingsource.filter not working Pin
Eddy Vluggen27-Jan-17 1:15
professionalEddy Vluggen27-Jan-17 1:15 
GeneralRe: bindingsource.filter not working Pin
Member 1108983127-Jan-17 4:26
Member 1108983127-Jan-17 4:26 
AnswerRe: bindingsource.filter not working Pin
Richard Deeming27-Jan-17 2:07
mveRichard Deeming27-Jan-17 2:07 
GeneralRe: bindingsource.filter not working Pin
Member 1108983127-Jan-17 4:23
Member 1108983127-Jan-17 4:23 
GeneralRe: bindingsource.filter not working Pin
Richard Deeming27-Jan-17 4:26
mveRichard Deeming27-Jan-17 4:26 
GeneralRe: bindingsource.filter not working Pin
Member 1108983127-Jan-17 7:20
Member 1108983127-Jan-17 7:20 
GeneralRe: bindingsource.filter not working Pin
Richard Deeming27-Jan-17 7:37
mveRichard Deeming27-Jan-17 7:37 
QuestionHow to compare 2 different text file lines and then process information if a match is in both file lines - Please help Pin
Member 1186689324-Jan-17 5:29
Member 1186689324-Jan-17 5:29 
I am attempting to build a command line tool that will create shortcuts for an application on the start menu and desktop. I have existing code that I use elsewhere to create the shortcuts. However, the program looks at two different files one file has only the site code and the other has the other information needed to created the shortcut by site for a whole region. The idea is to go through both lines until it finds the 3 letter abbreviation for the site in both files. For example one file only contains BEC (sites2.txt - the city) and the other file (R03Sites2.csv - Region) contains 50 lines with a different cities and all the pertinent information.

VB
Sub Main()
        '--------------------------------------------------------------------------------------------------------
        'Declare Variables
        Dim strSiteCode
        Dim strVistaFQDN
        Dim strPort
        Dim arrStr

        '--------------------------------------------------------------------------------------------------------
        'Start processing

        Using sr As New StreamReader("c:\dell\R03Sites2.csv")
            Dim line As String
            ' Read and display lines from the file until the end of
            ' the file is reached.
            Do
                line = sr.ReadLine()
                Dim Sites As String = My.Computer.FileSystem.ReadAllText("c:\dell\Sites2.txt")
                If Not (line Is Nothing) Then
                    Console.WriteLine("Start processing loop")
                    arrStr = Split(sr.ReadLine, ",")
                    strSiteCode = arrStr(0)
                    strVistaFQDN = arrStr(1)
                    strPort = arrStr(2)
                    Console.WriteLine("Array populated...  Enter if then statement")
                    If Trim(Sites) = Trim(strSiteCode) Then
                        Console.WriteLine(Trim(Sites) & " , " & Trim(strSiteCode))
                        Console.WriteLine("s=" & strVistaFQDN & " p=" & strPort)

                        'build shorcuts here.  Code to build shortcuts is working correctly when ran
                        'statically but it never finds a match so it always moves to the else and writes
                        'Console.WriteLine("Error:  No Matching Information in the Sites and R03sites files!")
                        'There is only 1 line is Sites and an array is created for the data in R03sites.
                        'My intention is to match the line in Sites to the portion of the array that correspondes
                        'to the site which is strSiteCode.  When it finds the match it is suppose to create the
                        'shortcut with the correct server name and port.


                        Console.WriteLine("Successfully processed!")
                        Exit Do
                    Else
                        Console.WriteLine("Error:  No Matching Information in the Sitecode and R03sites files!")
                    End If
                End If
            Loop Until line Is Nothing
        End Using
    End Sub



Here is the output:

\Dell>bcmass
Start processing loop
Array populated... Enter if then statement
Error: No Matching Information in the Sitecode and R03sites files!
Start processing loop
Array populated... Enter if then statement
Error: No Matching Information in the Sitecode and R03sites files!
Start processing loop
Array populated... Enter if then statement
Error: No Matching Information in the Sitecode and R03sites files!
Start processing loop
Array populated... Enter if then statement
Error: No Matching Information in the Sitecode and R03sites files!
Start processing loop
Array populated... Enter if then statement
Error: No Matching Information in the Sitecode and R03sites files!
Start processing loop
Array populated... Enter if then statement
Error: No Matching Information in the Sitecode and R03sites files!
Start processing loop
Array populated... Enter if then statement
Error: No Matching Information in the Sitecode and R03sites files!
Start processing loop
Array populated... Enter if then statement
Error: No Matching Information in the Sitecode and R03sites files!
Start processing loop
Array populated... Enter if then statement
Error: No Matching Information in the Sitecode and R03sites files!
Start processing loop
Array populated... Enter if then statement
Error: No Matching Information in the Sitecode and R03sites files!
Start processing loop
Array populated... Enter if then statement
Error: No Matching Information in the Sitecode and R03sites files!
Start processing loop
Array populated... Enter if then statement
Error: No Matching Information in the Sitecode and R03sites files!
Start processing loop
Array populated... Enter if then statement
Error: No Matching Information in the Sitecode and R03sites files!
Start processing loop
Array populated... Enter if then statement
Error: No Matching Information in the Sitecode and R03sites files!
Start processing loop
Array populated... Enter if then statement
Error: No Matching Information in the Sitecode and R03sites files!
Start processing loop
Array populated... Enter if then statement
Error: No Matching Information in the Sitecode and R03sites files!
Start processing loop
Array populated... Enter if then statement
Error: No Matching Information in the Sitecode and R03sites files!
Start processing loop
Array populated... Enter if then statement
Error: No Matching Information in the Sitecode and R03sites files!
Start processing loop
Array populated... Enter if then statement
Error: No Matching Information in the Sitecode and R03sites files!
Start processing loop
Array populated... Enter if then statement
Error: No Matching Information in the Sitecode and R03sites files!
Start processing loop

Unhandled Exception: System.IndexOutOfRangeException: Index was outside the bounds of the array.
at System.Array.InternalGetReference(Void* elemRef, Int32 rank, Int32* pIndices)
at System.Array.GetValue(Int32 index)
at Microsoft.VisualBasic.CompilerServices.Symbols.Container.GetArrayValue(Object[] Indices)
at Microsoft.VisualBasic.CompilerServices.NewLateBinding.InternalLateIndexGet(Object Instance, Object[] Arguments, String[] Argument
Names, Boolean ReportErrors, ResolutionFailure& Failure, Boolean[] CopyBack)
at Microsoft.VisualBasic.CompilerServices.NewLateBinding.ObjectLateInvokeDefault(Object Instance, Object[] Arguments, String[] Argum
entNames, Boolean ReportErrors, Boolean[] CopyBack)
at Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateIndexGet(Object Instance, Object[] Arguments, String[] ArgumentNames)
at BCMASS.Module1.Main()
AnswerRe: How to compare 2 different text file lines and then process information if a match is in both file lines - Please help Pin
Richard Deeming24-Jan-17 6:02
mveRichard Deeming24-Jan-17 6:02 
GeneralRe: How to compare 2 different text file lines and then process information if a match is in both file lines - Please help Pin
Member 1186689324-Jan-17 8:13
Member 1186689324-Jan-17 8:13 
GeneralRe: How to compare 2 different text file lines and then process information if a match is in both file lines - Please help Pin
Richard MacCutchan24-Jan-17 8:38
mveRichard MacCutchan24-Jan-17 8:38 
GeneralRe: How to compare 2 different text file lines and then process information if a match is in both file lines - Please help Pin
Member 1186689324-Jan-17 9:07
Member 1186689324-Jan-17 9:07 
GeneralRe: How to compare 2 different text file lines and then process information if a match is in both file lines - Please help Pin
Richard MacCutchan24-Jan-17 9:37
mveRichard MacCutchan24-Jan-17 9:37 
GeneralRe: How to compare 2 different text file lines and then process information if a match is in both file lines - Please help Pin
Member 1186689324-Jan-17 10:03
Member 1186689324-Jan-17 10:03 
PraiseRe: How to compare 2 different text file lines and then process information if a match is in both file lines - Please help Pin
Member 1186689325-Jan-17 5:42
Member 1186689325-Jan-17 5:42 
GeneralRe: How to compare 2 different text file lines and then process information if a match is in both file lines - Please help Pin
Richard MacCutchan25-Jan-17 5:57
mveRichard MacCutchan25-Jan-17 5:57 
GeneralRe: How to compare 2 different text file lines and then process information if a match is in both file lines - Please help Pin
Member 1186689324-Jan-17 9:11
Member 1186689324-Jan-17 9:11 
GeneralRe: How to compare 2 different text file lines and then process information if a match is in both file lines - Please help Pin
Eddy Vluggen25-Jan-17 6:21
professionalEddy Vluggen25-Jan-17 6:21 
QuestionHow to download all latest files from ftp server to pc automatically in vb.net Pin
Member 1295777522-Jan-17 15:38
Member 1295777522-Jan-17 15:38 
AnswerRe: How to download all latest files from ftp server to pc automatically in vb.net Pin
Michael_Davies22-Jan-17 20:43
Michael_Davies22-Jan-17 20:43 
GeneralRe: How to download all latest files from ftp server to pc automatically in vb.net Pin
Member 1295777522-Jan-17 21:09
Member 1295777522-Jan-17 21:09 
GeneralRe: How to download all latest files from ftp server to pc automatically in vb.net Pin
NotPolitcallyCorrect23-Jan-17 2:20
NotPolitcallyCorrect23-Jan-17 2:20 
QuestionHow to download all latest files from ftp server to pc automatically in vb.net Pin
Member 1295777522-Jan-17 15:07
Member 1295777522-Jan-17 15:07 
QuestionIsolating text within a text box Pin
Member 1296154621-Jan-17 13:27
Member 1296154621-Jan-17 13:27 
AnswerRe: Isolating text within a text box Pin
NotPolitcallyCorrect21-Jan-17 15:13
NotPolitcallyCorrect21-Jan-17 15:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.