|
string text = File.ReadAllText(filename)
You can then search for different strings within your string using IndexOf, Substring etc. If you don't like this approach study MDSN for System.IO.File class. It has a lot of static methods that can help you read a text file in different ways.
Do your best to be the best
|
|
|
|
|
You can use the readline function of the StreamReader. If the line contains the desired text such as txt 1, then read the next line and you will get the customer name etc.
|
|
|
|
|
Hi all,
How can i convert a PDF to JPG image page by page. Also I wish to save the images with the page number as file name.
For Eg:
If the PDF has 5 Pages. The first page should be converted as jpg and saved in the name as 1.jpg, for the second page 2.jpg................5.jpg
Is it possible to create this without using any third party tools/DLL. I wish to cretae this application using C#.NET 2.0
Plz help me.
Thanks in advance
Know is Drop, Unknown is Ocean
|
|
|
|
|
Exelioindia wrote: Is it possible to create this without using any third party tools/DLL.
The reason third party libraries exist is that C# has no support for this. Otherwise, no-one would buy the libraries. The PDF standard is free to download, your other option is to write your own, or look around source forge for something free.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
Thanks for your suggestion. Now i got clear. Is there any dll with source, so that i can learn how they did it. Plz give me some samples to link's from where i can learn myself and do it.
Thanks once again
Know is Drop, Unknown is Ocean
|
|
|
|
|
Christian already pointed you towards SourceForge. Try there.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi,
WindowsPrincipal object gives null value when checked in component .It throws me a exception "unable to cast object of type "system.security.principal.genericprincipal to type system.security.principal.windowsprincipal " where as if the same code is used in winforms I get the current windows username correctly.The one line code that I use is,
" WindowsPrincipal user = (WindowsPrincipal)System.Threading.Thread.CurrentPrincipal;"
does that mean that current thread of the windows application has different authentication than its own components.
Iam confused ..!!any help..
Regards,
Naveen
|
|
|
|
|
Hi I wanna know Assembly path....(the path where all the assemblies are stored...)
Thanks,
Prashanth
|
|
|
|
|
Have a look at this[^] article on Fusion. Fusion provides you with information on the GAC (as well as other assembly locations).
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I am trying to send a mail through my console application which is in .Net 2.0 with C# language. I am using the class System.Net.Mail.SmtpClient to send a mail. This was decided because the older version of this class System.Web.Mail.SmtpMail is now totally obsolete.
But I get an error message as "Failure sending mail." when I run my code.
I tried to resolve this by following:
1. Tried pinging the address from command prompt. It shows reply.
2. Assigned port number as number 25. Doesn't work. Gives same error.
Following is my code
FromEmail = "anil.soman@xyz.com";
strEmailAddre = "somebody@xyz.com";
strSubject = "some subject";
strBody = "some text for body";
System.Net.Mail.SmtpClient SMTPClient = new System.Net.Mail.SmtpClient();
SMTPClient.Host = "smtpservername";
SMTPClient.Port = 25;
SMTPClient.Send(FromEmail, strEmailAddre, strSubject, strBody);
What could be the reason for this? Any suggessions? Thanks in advance.
Regards,
Anil
|
|
|
|
|
A M SOMAN wrote: Any suggessions?
1) Create an MailMessage object. I know it's the same thing but...you can give it a try.
2) Check the port number, because usually it's 25 but it can differ from one server to another
3) Try configuring an email client like Outlook and if that doesn't also work....it's from somewhere else than your App
Hope it helps.
Do your best to be the best
|
|
|
|
|
Thanks for your suggessions karkster. Unfortunately it's not working.
I came to know that the code is not working because my local machine does not have SMTP server installed on it. So I need to run the code on a machine where it is installed already. Will try for this.
|
|
|
|
|
You only need IIS, which comes with Windows
Do your best to be the best
|
|
|
|
|
Hello,
I'm doing some free-time programming with learning objective (in c#), and one of my "projects" led me to separate data taken from a text file.
Opening and retrieving data is no problem, I just put it into a ArrayList of string element for now. But when I want to separate the data from that ArrayList, the only solution I've come up with is as 'ugly' as this one:
ArrayList stream = new ArrayList();
(some code here)
foreach (string str in stream)
{
if (str.contains(some string))
{
do something
}
else
{
if (str.contains(some other string))
{
do other thing
}
else
{
(... even more if's)
}
}
}
I think there should be another way to do this, specially without so much "contains" operations that are time consuming.
Can you give me some directions on how to break such items apart?
I'm thinking this could also be used in other areas like socket communication.
This feels like a very dumb question to me, but if I don't ask, I'll never learn.
Thanks for any help you can give me.
|
|
|
|
|
Try using a List<string> template instead of an ArrayList. This class has a FindAll method that you could find to be helpful.
Hope it helps.
Do your best to be the best
|
|
|
|
|
It's a good sugestion, especially with the use of a "Predicate" in the search field.
However, now I've got a new question...
Is it possible with .net 2.0 to get a range of data between known delimiters using predicate's? This would be soooo much cleaner.
Thanks for the hint.
|
|
|
|
|
I don't want to be rude, but take a look in Visual Studio's Help - MSDN, you'll get most of your answers there.
rsaint27 wrote: Is it possible with .net 2.0 to get a range of data between known delimiters using predicate's?
I suppose you have seen that the FindAll method retuns a List<list>, so you can call the list's GetRange method...;)...would that help?
Do your best to be the best
|
|
|
|
|
Thanks again for your help,
And I'll look better in reference documentation before posting here.
|
|
|
|
|
Try it...it doesn't hurt
Do your best to be the best
|
|
|
|
|
i'm using maked textbox to get time as data in my application... i wana to subract values in masked textbox2 and masked textbox 1, but there comes an error that "-" opertor cannot be used for the operands in masked textbox, during compilation. pls help me solve the problem............
-- modified at 5:48 Monday 8th October, 2007
|
|
|
|
|
firstly use proper language.. not some 'i wana 2 subract'...
secondly.. give more description.. 'to get time format ' - 'wana 2 subract values in 2 textbox' so what o you really want?
some code maybe useful..
life is study!!!
|
|
|
|
|
Hi!
so i've got this generic method:
<br />
UserControl _control;<br />
<br />
public void InitializeSomething<Tclass>(WorkItem workItem) where Tclass : UserControl {<br />
_control = workItem.Items.AddNew<Tclass>();<br />
}
my goal is to call this method sth like this:
<br />
Type someType = typeof(someOtherObject);<br />
someObj.InitializeSomething<someType>(WorkItem);<br />
but this of course won't work..
my question is: is it possible to pass variable containing some type as Tclass for generic?!
thanks for any help!!!
life is study!!!
|
|
|
|
|
I don't really get what you're aiming for... Doe you want to create a collection of controls which are derived from some kind of type?
|
|
|
|
|
mmh..
well, for example List<>.. inside the <> you have to put class name.. and my aim is to pass this class name through some variable.
life is study!!!
|
|
|
|
|
You can't specify the type for generics with a variable. The point with generics is that the type is known at compile time so that the compiler can generate the code for the created generic type.
---
single minded; short sighted; long gone;
|
|
|
|