Click here to Skip to main content
15,888,968 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: mciSendCommand in VB.NET Pin
Sasha Laurel19-Jul-12 9:10
Sasha Laurel19-Jul-12 9:10 
Generalplease upload Pin
MD Chalodiya16-Jul-12 20:02
MD Chalodiya16-Jul-12 20:02 
AnswerRe: please upload Pin
Eddy Vluggen16-Jul-12 21:50
professionalEddy Vluggen16-Jul-12 21:50 
GeneralBound datagridview with unbound combobox Column - Problems Pin
alejx16-Jul-12 14:48
alejx16-Jul-12 14:48 
GeneralRe: Bound datagridview with unbound combobox Column - Problems Pin
Sasha Laurel18-Jul-12 13:23
Sasha Laurel18-Jul-12 13:23 
GeneralSearchprogram for text in multi excel sheets Pin
abjac@16-Jul-12 6:23
abjac@16-Jul-12 6:23 
QuestionRe: Searchprogram for text in multi excel sheets Pin
Richard MacCutchan16-Jul-12 7:45
mveRichard MacCutchan16-Jul-12 7:45 
GeneralRe: Searchprogram for text in multi excel sheets Pin
abjac@16-Jul-12 10:30
abjac@16-Jul-12 10:30 
Sorry that was maybe the wrong expression. I made this setup and the search bottum(button1), when i press it it always comes up with and error. But the fact is that the code comes up with this error.

Could not find a part of the path 'C:\Documents and Settings\Alancecille\Desktop\listbox1.text'.
DirectoryNotFoundException was unhandled


But this is the path i add in listbox1 with out any problems. So i dont know why it can not find it.And also i dont know if i can use this code. The idea is to add the files(xls) i want to search in in Listbox1 and then then type the search word in textbox1, and when i press search, it shall find all strings(or formula) in the excel sheet, which have this word included. Please have a look at below code and come with some suggestions.

Thanks in advance

abjac



This is my code and as you can see the code for bottun1 is the one which cause the error, but also i think this maybe is not correct.

Imports System.IO

Public Class Form1
Dim streamer As IO.StreamReader
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim open As New OpenFileDialog
Try
open.Title = "Open Excel Sheets"
open.FileName = "xls"
open.Multiselect = True
open.Filter = "xls files |*.xls"
If open.ShowDialog = Windows.Forms.DialogResult.OK Then
For Each file As String In open.FileNames
ListBox1.Items.Add(file)
file = False
Next
End If
Catch ex As Exception
End Try
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
ListBox1.Items.Remove(ListBox1.SelectedItem)
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
ListBox1.Items.Clear()
End Sub

Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
ListBox2.Items.Clear()
End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
ListBox2.Items.Remove(ListBox2.SelectedItem)
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim filenames = My.Computer.FileSystem.FindInFiles("listbox1.text", "textbox1.text", True, FileIO.SearchOption.SearchAllSubDirectories)

For Each filename As String In filenames
ListBox2.Show()
Next


End Sub




Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
Dim SaveFile As New SaveFileDialog()
SaveFile.Filter = "Multi search in Excel |*.xls"
SaveFile.FileName = "xls"
SaveFile.ShowDialog()
Dim WriteFile As New System.IO.StreamWriter(SaveFile.FileName)
Dim Count As Integer = ListBox1.Items.Count - 1
For i As Integer = 0 To Count
WriteFile.Write(ListBox2.Items.Item(i) & ";") 'the “;” is used to separate the items
Next
WriteFile.Close()
End Sub





End Class

modified 16-Jul-12 16:44pm.

GeneralRe: Searchprogram for text in multi excel sheets Pin
JR21216-Jul-12 19:01
JR21216-Jul-12 19:01 
GeneralRe: Searchprogram for text in multi excel sheets Pin
Richard MacCutchan16-Jul-12 21:16
mveRichard MacCutchan16-Jul-12 21:16 
GeneralRe: Searchprogram for text in multi excel sheets Pin
abjac@16-Jul-12 22:35
abjac@16-Jul-12 22:35 
GeneralRe: Searchprogram for text in multi excel sheets Pin
Richard MacCutchan16-Jul-12 22:50
mveRichard MacCutchan16-Jul-12 22:50 
GeneralRe: Searchprogram for text in multi excel sheets Pin
abjac@16-Jul-12 23:23
abjac@16-Jul-12 23:23 
GeneralRe: Searchprogram for text in multi excel sheets Pin
abjac@17-Jul-12 5:44
abjac@17-Jul-12 5:44 
GeneralRe: Searchprogram for text in multi excel sheets Pin
abjac@18-Jul-12 10:48
abjac@18-Jul-12 10:48 
GeneralRe: Searchprogram for text in multi excel sheets Pin
Richard MacCutchan18-Jul-12 21:43
mveRichard MacCutchan18-Jul-12 21:43 
GeneralRe: Searchprogram for text in multi excel sheets Pin
abjac@19-Jul-12 0:40
abjac@19-Jul-12 0:40 
GeneralRe: Searchprogram for text in multi excel sheets Pin
Richard MacCutchan19-Jul-12 2:05
mveRichard MacCutchan19-Jul-12 2:05 
QuestionVB and API Pin
Darryl Gschwind14-Jul-12 10:41
Darryl Gschwind14-Jul-12 10:41 
AnswerRe: VB and API Pin
Wes Aday14-Jul-12 12:11
professionalWes Aday14-Jul-12 12:11 
GeneralRe: VB and API Pin
Darryl Gschwind14-Jul-12 14:13
Darryl Gschwind14-Jul-12 14:13 
QuestionEnable usb ports Pin
aliali7414-Jul-12 3:48
aliali7414-Jul-12 3:48 
AnswerRe: Enable usb ports Pin
Wes Aday14-Jul-12 3:57
professionalWes Aday14-Jul-12 3:57 
AnswerRe: Enable usb ports Pin
ZappaDog30-Jul-12 8:28
ZappaDog30-Jul-12 8:28 
Questiondata connectivity Pin
shubham salwan12-Jul-12 18:16
shubham salwan12-Jul-12 18:16 

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.