473,396 Members | 1,771 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

two dlls + arguments

I need to search a string in some text files.
(any good routines out there?)

then, I created a mysearch.exe with a method that will search for a String
in a fileName.
I want "string to search" and "fileName" to be the params in mysearch.exe /
method.
Is there any way to call mysearch.exe from another exe using
mysearch.exe("searchthisstring","inthisfile.txt")
if so... how?, any ideas or tips are accepted.
Thanks
The exception that is thrown when one of the arguments provided to a method
is not valid.
Nov 21 '05 #1
5 891
"raulavi" <ra*****@discussions.microsoft.com> schrieb:
I need to search a string in some text files.
(any good routines out there?)
Basic file reading samples (text, binary):

Reading a text file line-by-line or blockwise with a progress indicator
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=readfile&lang=en>

You can use 'InStr' to check if a certain string is contained in each line.
then, I created a mysearch.exe with a method that will search for a
String
in a fileName.
I want "string to search" and "fileName" to be the params in mysearch.exe
/
method.
\\\
Public Module Program
Public Function Main(ByVal Args() As String) As Integer
For Each Arg As String In Args
Console.WriteLine(Arg)
Next Arg
End Function
End Module
///

Select 'Sub Main' as startup object in the project properties.
Is there any way to call mysearch.exe from another exe using
mysearch.exe("searchthisstring","inthisfile.txt")
if so... how?, any ideas or tips are accepted.


\\\
Imports System.Diagnostics
..
..
..
Process.Start( _
"mysearch.exe", _
"""searchthis string"" ""inthisfile.txt""" _
)
///

BTW: Applications are no methods, so throwing an exception doesn't make
much sense. However, you can write an information message to the console
and set the exit code ('Return <exit code>') in 'Function Main'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2

"raulavi"

Reading a text file line-by-line or blockwise with a progress indicator

Reading a text file line-by-line:

\\\
Imports System.IO
..
..
..
Dim Reader As New StreamReader("C:\WINDOWS\WIN.INI")
Do While Reader.Peek > -1
Debug.WriteLine(Reader.ReadLine())
Loop
Reader.Close()
///
You can use 'IndexOf' to check if a certain string is contained in each
line.

I hope this helps,

Cor
Nov 21 '05 #3
Roulavi,

I copied the wrong one

\\\
Imports System.IO
Imports System.Text
..
..
..
Dim Reader As New BinaryReader( _
New FileStream("C:\WINDOWS\WIN.INI", IO.FileMode.Open) _
)
Dim Buffer() As Byte
Me.ProgressBar1.Minimum = 0
Me.ProgressBar1.Maximum = Reader.BaseStream.Length
Dim BytesRead As Long
Const BlockSize As Integer = 1024 ' Read blocks of 1,024 bytes.
Do While BytesRead < Reader.BaseStream.Length
Buffer = Reader.ReadBytes(BlockSize)
Debug.Write(System.Text.Encoding.Default.GetString (Buffer))
BytesRead = BytesRead + Buffer.Length
Me.ProgressBar1.Value = BytesRead
Loop
Reader.Close()
///

You can use 'IndexOf' to check if a certain string is contained in each
line.

I hope this helps,

Cor
Nov 21 '05 #4
thanks
BTW: Applications are no methods, so throwing an exception doesn't make
much sense. However, you can write an information message to the console
and set the exit code ('Return <exit code>') in 'Function Main'. <<
Could you detail a litlle bit more on how to do it...I need to receive a
text...
(what is the statement that will return a string to my caller.)
what really goes into the caller and what goes into the called ...I know
this must be easy routines for many developers, but there are so many ways to
do it, and I need the one taht will always will.

Thanks again

"Herfried K. Wagner [MVP]" wrote:
"raulavi" <ra*****@discussions.microsoft.com> schrieb:
I need to search a string in some text files.
(any good routines out there?)


Basic file reading samples (text, binary):

Reading a text file line-by-line or blockwise with a progress indicator
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=readfile&lang=en>

You can use 'InStr' to check if a certain string is contained in each line.
then, I created a mysearch.exe with a method that will search for a
String
in a fileName.
I want "string to search" and "fileName" to be the params in mysearch.exe
/
method.


\\\
Public Module Program
Public Function Main(ByVal Args() As String) As Integer
For Each Arg As String In Args
Console.WriteLine(Arg)
Next Arg
End Function
End Module
///

Select 'Sub Main' as startup object in the project properties.
Is there any way to call mysearch.exe from another exe using
mysearch.exe("searchthisstring","inthisfile.txt")
if so... how?, any ideas or tips are accepted.


\\\
Imports System.Diagnostics
..
..
..
Process.Start( _
"mysearch.exe", _
"""searchthis string"" ""inthisfile.txt""" _
)
///

BTW: Applications are no methods, so throwing an exception doesn't make
much sense. However, you can write an information message to the console
and set the exit code ('Return <exit code>') in 'Function Main'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #5
thanks
BTW: Applications are no methods, so throwing an exception doesn't make
much sense. However, you can write an information message to the console
and set the exit code ('Return <exit code>') in 'Function Main'. <<

Could you detail a litlle bit more on how to do it...I need to receive a
text...
(what is the statement that will return a string to my caller.)
what really goes into the caller and what goes into the called ...I know
this must be easy routines for many developers, but there are so many ways to
do it
Thanks again

"Herfried K. Wagner [MVP]" wrote:
"raulavi" <ra*****@discussions.microsoft.com> schrieb:
I need to search a string in some text files.
(any good routines out there?)
Basic file reading samples (text, binary):

Reading a text file line-by-line or blockwise with a progress indicator
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=readfile&lang=en>

You can use 'InStr' to check if a certain string is contained in each line.
then, I created a mysearch.exe with a method that will search for a
String
in a fileName.
I want "string to search" and "fileName" to be the params in mysearch.exe
/
method.


\\\
Public Module Program
Public Function Main(ByVal Args() As String) As Integer
For Each Arg As String In Args
Console.WriteLine(Arg)
Next Arg
End Function
End Module
///

Select 'Sub Main' as startup object in the project properties.
Is there any way to call mysearch.exe from another exe using
mysearch.exe("searchthisstring","inthisfile.txt")
if so... how?, any ideas or tips are accepted.


\\\
Imports System.Diagnostics
..
..
..
Process.Start( _
"mysearch.exe", _
"""searchthis string"" ""inthisfile.txt""" _
)
///

BTW: Applications are no methods, so throwing an exception doesn't make
much sense. However, you can write an information message to the console
and set the exit code ('Return <exit code>') in 'Function Main'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>


"Herfried K. Wagner [MVP]" wrote:
"raulavi" <ra*****@discussions.microsoft.com> schrieb:
I need to search a string in some text files.
(any good routines out there?)


Basic file reading samples (text, binary):

Reading a text file line-by-line or blockwise with a progress indicator
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=readfile&lang=en>

You can use 'InStr' to check if a certain string is contained in each line.
then, I created a mysearch.exe with a method that will search for a
String
in a fileName.
I want "string to search" and "fileName" to be the params in mysearch.exe
/
method.


\\\
Public Module Program
Public Function Main(ByVal Args() As String) As Integer
For Each Arg As String In Args
Console.WriteLine(Arg)
Next Arg
End Function
End Module
///

Select 'Sub Main' as startup object in the project properties.
Is there any way to call mysearch.exe from another exe using
mysearch.exe("searchthisstring","inthisfile.txt")
if so... how?, any ideas or tips are accepted.


\\\
Imports System.Diagnostics
..
..
..
Process.Start( _
"mysearch.exe", _
"""searchthis string"" ""inthisfile.txt""" _
)
///

BTW: Applications are no methods, so throwing an exception doesn't make
much sense. However, you can write an information message to the console
and set the exit code ('Return <exit code>') in 'Function Main'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Todd Gardner | last post by:
Hello all, Pardon my ignorance here. I would like to talk to someone that has had success in calling ddls in Windows NT/2000/XP. I am wondering where to dload any of these packages? Google...
7
by: byte biscuit | last post by:
Hi there everybody! The problem is the following: we have a DLL (H2O.dll) - compiled in Visual Fortran - depending in turn on another DLL. H2O.dll contains only one (1) function, with a known...
14
by: Florian | last post by:
Hi, I have a question regarding Application Development and the usage of DLLs. Because my EXE is growing I'm not sure if I should put some code into a DLL. But what kind of code should I put...
2
by: Johann Blake | last post by:
I can hardly believe I'm the first one to report this, but having gone through the newsgroup, it appears that way. I would like to open a solution in the VS.NET IDE that consists of multiple...
2
by: Shiraz | last post by:
Hi I just made an installer for an application that uses two external COM dlls. On the surface, everything seems to be running smoothly and the the application runs without any errors. However,...
11
by: Devender Khari | last post by:
Hi Friends, I'm facing a situation as follows, need help on identifying possible issues. There is an MFC application developed in VC6.0, say ABCVC6.exe and another developed in VC.NET, say...
11
by: Andrey Mazurov | last post by:
Hi! Please advise. Can I use DLLs from GAC in ASP.NET applications? How? Thanks, Ray
0
by: ZMan | last post by:
Scenario: This is about debugging server side scripts that make calls to middle-tier business DLLs. The server side scripts are legacy ASP 3.0 pages, and the DLLs are managed DLLs...
10
by: =?Utf-8?B?UmljaGFyZA==?= | last post by:
Hi, I usually deploy my ASP .NET application to the server by publishing, using Visual Studio 2005 publish feature. This creates the Bin folder on the server, with the compiled DLLs. I've...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.