Click here to Skip to main content
15,910,123 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Questionhelp pls , doubt with collection class in vb Pin
tejaswi-teja7-Nov-05 2:05
tejaswi-teja7-Nov-05 2:05 
QuestionProblem With ImageList control Pin
Anindya Chatterjee7-Nov-05 0:27
Anindya Chatterjee7-Nov-05 0:27 
Questionclient/server communication Pin
sahil puri6-Nov-05 22:21
sahil puri6-Nov-05 22:21 
QuestionHelpNameSpace linked to host machine Pin
nashdb6-Nov-05 16:36
nashdb6-Nov-05 16:36 
AnswerRe: HelpNameSpace linked to host machine Pin
nikneem20057-Nov-05 2:34
nikneem20057-Nov-05 2:34 
GeneralRe: HelpNameSpace linked to host machine Pin
nashdb7-Nov-05 4:27
nashdb7-Nov-05 4:27 
GeneralRe: HelpNameSpace linked to host machine Pin
nashdb7-Nov-05 7:36
nashdb7-Nov-05 7:36 
QuestionHelp Needed = Listbox populated from .txt file - process each item in list through loop Pin
r00tb0x6-Nov-05 14:50
r00tb0x6-Nov-05 14:50 
First I'd like to say that I've been trying to find a solution for 2 days from many resources. The code runs but only the first item in the listbox is being killed.

My textfile = "list.txt"

Contents of list.txt

notepad
wordpad

Here is a snipit of the main section of my code.

<br />
Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
        'Opens File Specified as .txt only<br />
        Dim openFile As New System.Windows.Forms.OpenFileDialog<br />
        openFile.DefaultExt = "txt"<br />
        openFile.Filter = "Text documents (*.txt)|*.txt"<br />
        openFile.ShowDialog()<br />
        If openFile.FileNames.Length > 0 Then<br />
            Dim filename As String<br />
            For Each filename In openFile.FileNames<br />
                ' Displays path of text file to listBox1<br />
                ListBox1.Items.Add(filename)<br />
                'Displays content of selected text file to listBox2<br />
                Dim file As New System.IO.StreamReader(filename)<br />
                Dim oneLine As String<br />
                oneLine = file.ReadLine()<br />
                While (oneLine <> "")<br />
                    ListBox2.Items.Add(oneLine)<br />
                    oneLine = file.ReadLine()<br />
                End While<br />
                file.Close()<br />
            Next<br />
        End If<br />
    End Sub<br />
    Public Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click<br />
        'Checks to check if items in listbox2 are selected<br />
        Dim n As String<br />
        n = ListBox2.Text<br />
        If n = "" Then MsgBox("No Process Selected!", MsgBoxStyle.Information, "Process Not Selected")<br />
        'Compares items in textbox2 against running processes, if found it kills it<br />
        Dim lined As String<br />
        Dim proc() As Process<br />
        Dim i As Integer<br />
        Dim prokill As Boolean<br />
        lined = (ListBox2.Text)<br />
        proc = Diagnostics.Process.GetProcesses<br />
        For i = 0 To proc.Length - 1<br />
            If proc(i).ProcessName = lined Then<br />
                Try<br />
                    proc(i).Kill()<br />
                    prokill = True<br />
                Catch ex As Exception<br />
                    Exit Sub<br />
                End Try<br />
            End If<br />
        Next i<br />
<br />
        'removes killed processes from listbox2<br />
        ListBox2.Items.Remove(ListBox2.Text)<br />
        ListBox2.SelectedIndex = -1<br />
        'ListBox2.Items.Clear()<br />
    End Sub<br />


I've tried adding listbox2.text to a database, but my research and small amount of experience leave me with a headache for 2 days... any help or guidance would be greatly appreiciated. Thanks.
AnswerRe: Help Needed = Listbox populated from .txt file - process each item in list through loop Pin
Christian Graus6-Nov-05 15:06
protectorChristian Graus6-Nov-05 15:06 
GeneralRe: Help Needed = Listbox populated from .txt file - process each item in list through loop Pin
r00tb0x6-Nov-05 15:38
r00tb0x6-Nov-05 15:38 
GeneralRe: Help Needed = Listbox populated from .txt file - process each item in list through loop Pin
Christian Graus6-Nov-05 15:52
protectorChristian Graus6-Nov-05 15:52 
GeneralRe: Help Needed = Listbox populated from .txt file - process each item in list through loop Pin
r00tb0x6-Nov-05 16:00
r00tb0x6-Nov-05 16:00 
GeneralRe: Help Needed = Listbox populated from .txt file - process each item in list through loop Pin
Christian Graus6-Nov-05 16:01
protectorChristian Graus6-Nov-05 16:01 
GeneralRe: Help Needed = Listbox populated from .txt file - process each item in list through loop Pin
r00tb0x6-Nov-05 16:27
r00tb0x6-Nov-05 16:27 
QuestionA component that does a databindable print document type thing? Pin
Duncan Edwards Jones6-Nov-05 11:08
professionalDuncan Edwards Jones6-Nov-05 11:08 
QuestionComboBox onchange Pin
TigerNige6-Nov-05 10:09
TigerNige6-Nov-05 10:09 
AnswerRe: ComboBox onchange Pin
Nibu babu thomas6-Nov-05 21:12
Nibu babu thomas6-Nov-05 21:12 
GeneralRe: ComboBox onchange Pin
TigerNige6-Nov-05 23:56
TigerNige6-Nov-05 23:56 
GeneralRe: ComboBox onchange Pin
Nibu babu thomas7-Nov-05 0:13
Nibu babu thomas7-Nov-05 0:13 
GeneralRe: ComboBox onchange Pin
TigerNige7-Nov-05 11:38
TigerNige7-Nov-05 11:38 
QuestionFind Method - Finding the closest record match Pin
dptalt6-Nov-05 4:56
dptalt6-Nov-05 4:56 
AnswerRe: Find Method - Finding the closest record match Pin
Christian Graus6-Nov-05 12:59
protectorChristian Graus6-Nov-05 12:59 
GeneralRe: Find Method - Finding the closest record match Pin
dptalt7-Nov-05 14:48
dptalt7-Nov-05 14:48 
GeneralRe: Find Method - Finding the closest record match Pin
Christian Graus7-Nov-05 15:04
protectorChristian Graus7-Nov-05 15:04 
GeneralRe: Find Method - Finding the closest record match Pin
dptalt8-Nov-05 15:36
dptalt8-Nov-05 15:36 

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.