Click here to Skip to main content
16,006,341 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: How do I embed a new control into MS Word? Pin
ips_sun8-Jun-07 0:38
ips_sun8-Jun-07 0:38 
Questionoracle client component Pin
shereem khaleel7-Jun-07 9:37
shereem khaleel7-Jun-07 9:37 
AnswerRe: oracle client component Pin
mr_lasseter7-Jun-07 14:56
mr_lasseter7-Jun-07 14:56 
GeneralRe: oracle client component Pin
shereem khaleel7-Jun-07 15:33
shereem khaleel7-Jun-07 15:33 
QuestionHow can I get my web page in center of a browser Pin
AliHemani7-Jun-07 9:07
AliHemani7-Jun-07 9:07 
AnswerRe: How can I get my web page in center of a browser Pin
Christian Graus7-Jun-07 15:31
protectorChristian Graus7-Jun-07 15:31 
AnswerRe: How can I get my web page in center of a browser Pin
Steven J Jowett8-Jun-07 3:27
Steven J Jowett8-Jun-07 3:27 
Questionadding files to listboxes Pin
jds12077-Jun-07 4:05
jds12077-Jun-07 4:05 
I have a program that will search directories and add files to a listbox by the extension you enter. I have a table created in access that contains files. The program will check the database to see if files exist. I have it where if the path in tblExclude is equal to the path textbox1 then add files to listbox 2 and all other files are added to listbox1. My problem is I don't want the files that are added to listbox2 to be added to textbox1. The files that are in tblExclude are being added to both listboxes instead of just listbox2. Can someone please help me with this? Here is my code:

'Get the entered file paths and patterns<br />
        Dim enteredFilePaths As String() = TextBox1.Text.Split(New String() {";"}, StringSplitOptions.RemoveEmptyEntries)<br />
        Dim patterns As String() = TextBox2.Text.Split(New String() {";"}, StringSplitOptions.RemoveEmptyEntries)<br />
<br />
        'Declare a string array to store the file paths that are not found in the database<br />
        Dim filePaths() As String = Nothing<br />
        Dim dv As DataView = dt.DefaultView<br />
        dv.Sort = "ExcludePath ASC"<br />
<br />
        For Each path As String In enteredFilePaths<br />
<br />
            'Check to make sure the file path does not have "\" as it's last character.<br />
            If path.LastIndexOf("\") = path.Length - 1 Then<br />
                path = path.Substring(0, path.Length - 1)<br />
            End If<br />
<br />
            Dim rows As DataRowView() = dv.FindRows(path)<br />
<br />
            If rows.Length > 0 Then<br />
<br />
                'Only add the file if it is one of the entered extensions.<br />
                For Each row As DataRowView In rows<br />
                    If ListBox2.Items.Contains(row.Item("ExcludeFileName")) Then<br />
<br />
                    End If<br />
<br />
                    Dim ext As String = System.IO.Path.GetExtension(row.Item("ExcludeFileName").ToString).Replace(".", "")<br />
                    If Me.TextBox2.Text.IndexOf(ext, 0, StringComparison.CurrentCultureIgnoreCase) > -1 Then<br />
<br />
                        'It was found in the database, display it in the listbox.<br />
                        Me.ListBox2.Items.Add(row.Item("ExcludeFileName"))<br />
                    End If<br />
                Next<br />
            Else<br />
                'It was not found in the database<br />
                Dim i2 As Integer = 0<br />
                If Not filePaths Is Nothing Then<br />
                    i2 = UBound(filePaths) + 1<br />
                End If<br />
<br />
                'Resize the array<br />
                ReDim filePaths(i2)<br />
<br />
                'Add the path to the array<br />
                filePaths(i2) = path<br />
                End If<br />
<br />
        Next<br />
        GetDirectoryContents(enteredFilePaths, patterns)<br />
        <br />
    End Sub<br />
<br />
    Private Sub GetDirectoryContents(ByVal dirs() As String, ByVal patterns() As String)<br />
        'Declare variable.<br />
        Dim dDir As DirectoryInfo<br />
<br />
        'Search directory for files and add to the listbox.<br />
        For Each sDir As String In dirs<br />
            If Not Directory.Exists(sDir) Then Continue For<br />
            dDir = New DirectoryInfo(sDir)<br />
            For Each ext As String In patterns<br />
                For Each fi As FileInfo In dDir.GetFileSystemInfos("*." & ext)<br />
                    ListBox1.Items.Add(fi.Name)<br />
                Next<br />
            Next<br />
        Next<br />
    End Sub


jds1207
AnswerRe: adding files to listboxes Pin
Johan Hakkesteegt7-Jun-07 21:15
Johan Hakkesteegt7-Jun-07 21:15 
QuestionQuestion about XML with C&amp;C SAPI app in VB.NET Pin
RoyZ7777-Jun-07 3:33
RoyZ7777-Jun-07 3:33 
GeneralAnybody? Please? Pin
RoyZ77710-Jun-07 11:36
RoyZ77710-Jun-07 11:36 
QuestionSubscript &amp; SuperScript in Crystal Report Pin
Rupesh Kumar Swami7-Jun-07 3:17
Rupesh Kumar Swami7-Jun-07 3:17 
QuestionClass Not Registered Pin
Paramhans Dubey7-Jun-07 3:08
professionalParamhans Dubey7-Jun-07 3:08 
AnswerRe: Class Not Registered Pin
Dave Kreskowiak7-Jun-07 4:09
mveDave Kreskowiak7-Jun-07 4:09 
GeneralRe: Class Not Registered Pin
Paramhans Dubey7-Jun-07 6:25
professionalParamhans Dubey7-Jun-07 6:25 
GeneralRe: Class Not Registered Pin
Dave Kreskowiak7-Jun-07 6:27
mveDave Kreskowiak7-Jun-07 6:27 
GeneralRe: Class Not Registered Pin
Paramhans Dubey7-Jun-07 19:50
professionalParamhans Dubey7-Jun-07 19:50 
GeneralRe: Class Not Registered Pin
Dave Kreskowiak8-Jun-07 3:34
mveDave Kreskowiak8-Jun-07 3:34 
QuestionWill VB.NET 2.0 allow dynamically created objects? Pin
Marcus J. Smith7-Jun-07 2:54
professionalMarcus J. Smith7-Jun-07 2:54 
AnswerRe: Will VB.NET 2.0 allow dynamically created objects? Pin
Colin Angus Mackay7-Jun-07 2:58
Colin Angus Mackay7-Jun-07 2:58 
GeneralRe: Will VB.NET 2.0 allow dynamically created objects? Pin
Marcus J. Smith7-Jun-07 4:40
professionalMarcus J. Smith7-Jun-07 4:40 
GeneralRe: Will VB.NET 2.0 allow dynamically created objects? Pin
Polymorpher7-Jun-07 6:46
Polymorpher7-Jun-07 6:46 
QuestionAccess VBA, how to call a method on a subform? Pin
Dan Neely7-Jun-07 2:48
Dan Neely7-Jun-07 2:48 
Questionhow do i remove selected row permanently from sql database through datagrid? Pin
sathyan_82947-Jun-07 2:27
sathyan_82947-Jun-07 2:27 
AnswerRe: how do i remove selected row permanently from sql database through datagrid? Pin
Dave Kreskowiak7-Jun-07 4:05
mveDave Kreskowiak7-Jun-07 4:05 

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.