|
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.
|
|
|
|
|
I wrote: ... for the underlined methods, which are undefined Maybe I have to repeat my question in other words? I'll try...
The underlined methods (used in all the samples I could find) seem to be part of ASP.NET (used in these samples), which seemingly aren't supported in VB.NET. So the error message for these (unknown) methods would be e.g. "'Request' hasn't been declared.", which I also understand.
I'm looking for a workaround to retrieve data using non-ASP methods, e.g. from the System.Net Namespace, which I also referenced. Still they don't offer 'HttpContext', neither does the System.Web Namespace in VB (which has also been referenced).
modified 11-Jul-12 10:27am.
|
|
|
|
|
The classes and methods that are defined in the .NET Framework are organized in namespaces; you are allowed to use them no matter what language you are using, or what kind of application you are building. All you need to do is make sure you have proper references in your project (which gets done automatically for some, depending on the type of project you are building).
Example:
http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest(v=vs.80).aspx[^]
I've build quite a few WinForm apps that use System.Net in general and HttpWebRequest and other classes in particular. The most well known app using them is CP Vanity[^]. And I never had a need for HttpContext (which belongs to System.Web).
|
|
|
|
|
Hi Luc,
maybe you have to know that for me it's the first time I deal with web data retrieval, which is why I use code samples as orientation. In addition to that, I'm neither a programmer nor a student in the field who missed out on his homework, but professionally working in a completely different area with a bit of passion for programming in my leisure time. I hope you can see the huge difference – and I wish I wouldn't have to feel let down from your answers, which I do . I can assure you that I referenced System.Net as well as System.Web, read douzends of sources (for hours in my leisure time!) which I even partly understand, before I ask in the forum – still it's a new and very comlex field for me, and I suppose asking in a forum is appropriate considering the basic idea of a forum, right?
Luc Pattyn wrote: I never had a need for HttpContext I don't want to compete or insist in a particular way of solving the coding problem I face. Using HttpContext or the exact methods from the samples isn't relevant, I guess, but I need the alternative in order to reach the same goal.
You are the expert here and you might have a much better idea what the relevant line of code is doing. I could only face the fact that I obviously have to get a byte array from something (Request, HttpContext) that I don't know yet, seeing from the sample that HttpContext etc is part of the logic how others create that byte array. Still, my version of VS2010 doesn't know the underlined methods/objects/properties despite of the references.
Since you never had the need for HttpContext: How would you get the proper byte array?
OK, excuse this long and a bit off-topic personal post - maybe I'm getting old and too easily annoyed when feeling talked down to me. Just in case you're around Munich (Germany) eventually, I'll buy you a beer and answer your probable questions in my own field of expertise
|
|
|
|
|
Hi Michael,
this is unlike you. This time around, you haven't explained in any detail what it is you are attempting ("read data from a website"), and what the symptoms are ("throwing errors"); all I could do is make a wild guess, hence the "add reference" suggestion, and now you say that wasn't it, and no new information. This way I can't help you, and I doubt anyone can. Please provide ample information (goals, context, code, detailed observations) if you want a helpful answer.
|
|
|
|