|
Hi My idea was that it should read,,, "Listbox1.text",,, and the path i add there and the same with the search word
read in this "textbox1.text" and the word i type there
I dont know how to do this, but i think if i put example the directory path directly in here and the search word after it would work. But how do i make this so it will search in the directory, what i add in Listbox1.text. ??
And search there for the word i type in Textbox1.text??
So i am sure i miss some code for make this to work. If any suggestions, it would be nice.
abjac
|
|
|
|
|
You just need to replace the strings in your method call with proper parameters which you initialise from the listbox [^] and the textbox [^]. Something like:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim litem As ListBoxItem
Dim dir As String
litem = listbox1.SelectedItem
dir = litem.Content.ToString
Dim filenames = My.Computer.FileSystem.FindInFiles(dir, textbox1.text, True, FileIO.SearchOption.SearchAllSubDirectories)
|
|
|
|
|
HI Thats great i will try when i come home tonight, still working here. But i will try and let you know if its working. Thanks for now abjac
|
|
|
|
|
HI I tried this code but its not working, i have tried different ways to avoid the error but wit no luck
The error is in this line "Dim Item As ListBoxItem"
Error 1 Type 'ListBoxItem' is not defined.
Try also to have a look to below code where i want to see the the result in Listbox2. Is this one ok you think?
Please have a look thanks
abjac
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Item As ListBoxItem
Dim dir As String
Item = ListBox1.SelectedItem
dir = Item.Content.ToString
Dim filenames = My.Computer.FileSystem.FindInFiles(dir, TextBox1.Text, True, FileIO.SearchOption.SearchAllSubDirectories)
For Each filename As String In filenames
ListBox2.Show()
Next
End Sub
|
|
|
|
|
HI I tried it and it didnt work get this error
'ListBoxItem' is not defined.
But now i am also not clear of if this is correct. I think this is for search in a folder but i want to search in an excel sheet after the word and display the info in Listbox2 where the word is found in the excel file
Any suggestions?
abjac
Dim Item As ListBoxItem
Dim dir As String
item = ListBox1.SelectedItem
dir = item.Content.ToString
Dim filenames = My.Computer.FileSystem.FindInFiles(dir, TextBox1.Text, True, FileIO.SearchOption.SearchAllSubDirectories)
For Each filename As String In filenames
ListBox2.Show()
Next
|
|
|
|
|
abjac@ wrote: 'ListBoxItem' is not defined.
Check the MSDN documentation[^].
abjac@ wrote: I think this is for search in a folder but i want to search in an excel sheet
Then I wonder why you are using FindInFiles .
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Well i am not expert, but thought FindInFIles was the solution, I want to find a word in a excel file. But please if you have any other solution, would be great to hear about
Thanks in advance
abjac
|
|
|
|
|
abjac@ wrote: but thought FindInFIles was the solution
It may well be the solution, but it depends on what you are trying to achieve. The method returns a list of filenames that contain the text you are searching for, if that is what you are trying to do. If you just need to find some text in a specific file then you may need to consider alternative options.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
What steps are necessary here:
Would like to write a program that takes over the mouse and keyboard so that another gets it's input from my program i.e. automated input from my program.
I would have to teach my program where all of the mouse click buttons are so my program could mouse move to these buttons, click, and enter the text as if it was human input.
Darryl Gschwind
|
|
|
|
|
Darryl Gschwind wrote: write a program
Is there any particular reason that you want to write a program to do this instead of using an already existing solution? I have used Autoit3[^] on many occasions to performs those very functions.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
The program would have many other duties to perform before it determines the mouse and keyboard entry.
My program is writing another program interfacing to a development platform.
A scrip would not be a solution.
It has been a log time since I have written VB code and it was VB6. Now I have access to VS2010
|
|
|
|
|
i need program in visual basic that disable all usb Ports
|
|
|
|
|
aliali74 wrote: i need program
And? Are you looking to hire someone to write it for you?
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
It doesn't take a program to do that. The registry value
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\
Services\UsbStor
stores that function.
Another approach is to prevent rights to \Inf\Usbstor.pnf and \Inf\Usbstor.inf files.
|
|
|
|
|
i had created a connection to the SQL Express database
but not able to create data-bound controls on the form
|
|
|
|
|
Do you have any error message?
it can be a million things why it aint working...
|
|
|
|
|
I am trying to find some direction on document searching. We have a Desktop application (VB.NET) and I want to incorporate document searching into the application. The application runs on a terminal server and accesses a standalone SQL server. I am currently looking into using the Indexing Service on a file server to index the documents(and possibly Exchange)) and then I will query the catalog(s), either directly from my application or, from my SQL server. When searching this topic I find that almost all of the discussions/examples revolve around web sites and searching web content. There seems to be no mention of doing this for a desktop application.
Am I on the right track?
Any pointers on:
-Querying index catalogs (VB.Net)?
-Running SQL queries on remote index servers
-Performance.
-Other options...
|
|
|
|
|
Hello,
I'm not completely sure to what you mean, but if your looking for a way to search for items in a directory (both network drive or local drive) you can use the following code:
Dim filenames = My.Computer.FileSystem.GetFiles("C:", FileIO.SearchOption.SearchAllSubDirectories, "*.txt")
For Each filename As String In filenames
messagebox.show(filename)
Next
this example will look for .txt files on your c drive and display each of there file paths in a messagebox. since this function uses the windows search function it will work faster if you got your drives indexed. also narrowing down your search path will speed things up.
for querying things from a SQL database you can just push a query text to the server while declaring it as a "SqlCommand" (dont forget to add Imports System.Data.SqlClient on top of your code). here[^] is a tutorial. its for ado.net but it works the same in a vb.net desktop application.
|
|
|
|
|
No, I want to be able to search content. I want to have a form in my application where the user types search terms and I return a list of documents that the content thereof matches the search criteria.
|
|
|
|
|
You mean content from inside the document? like a word or sentence?
|
|
|
|
|
Yes. I have Index Server cataloging the content already and I have a test windows app that queries the content of the catalog using OLEDB. This works fine when I run it on the index server. The problem is that I can't access the catalog from another machine.
Is there an easier way???
|
|
|
|
|
So basically what you now have is a database with the cataloged content of all the items?
Then i think the best way to go is to indeed use that database. If its a oledb you should be able to access it trough code. if it gives errors check if the permissions of the database allow a external user to read from it. And that there isnt a firewall blocking your path.
|
|
|
|
|
Hey,
Sorry for the double awsner but i ran into this today
Dim filenames = My.Computer.FileSystem.FindInFiles("C:\", "text you want to find", True, FileIO.SearchOption.SearchAllSubDirectories)
arguments: 1. root folder, 2. searched text, 3. ignore capital, 4. seachoption.
returntype: a array of file locations (string)
|
|
|
|
|
Hello community,
I'm trying to read data from a website into a WinForms app, but all the samples I find use ASP.NET Namespaces. Using the HttpWebRequest type from the System.Net Namespace, I get into trouble with
req.Method = "POST"
req.ContentType = "application/x-www-form-urlencoded"
Dim Param() As Byte = Request.BinaryRead(HttpContext.Current.Request.ContentLength)
Dim strRequest As String = encoding.ASCII.GetString(Param)
strRequest = strRequest + "&cmd=_notify-validate"
req.ContentLength = strRequest.Length throwing errors for the underlined methods, which are undefined. The rest seems to be ok.
Does someone have an idea how to replace the relevant line?
Thank you
Michael
|
|
|
|
|
Michael Schäuble wrote: throwing errors
Did you read the error messages? did you understand them? don't you think we could benefit and help you better when knowing the exact messages?
Did you add references to the namespaces you attempt to use? They get mentioned on the MSDN reference pages describing classes and methods.
|
|
|
|