By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,786 Members | 2,241 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,786 IT Pros & Developers. It's quick & easy.

want to read the first line from a text file and show it into a msg box in c#

P: 5
This is gaurav karode. i want a little code help.I am making an application in which i have to show a msg box and the content of msgbox will be from a text file. so basiclly i have to read the first line of text file and show it into a msg box. i tried different things but unable to do that. ican read from the text file but how to show it into a msg box.One more thing we can use msgbox.showin windows application but cant into a web application. i want the code so that i can perform this task.
Thanking You
gaurav karode
Jul 29 '10 #1
Share this Question
Share on Google+
6 Replies

Expert 100+
P: 449
Have you tried it...
Then Post some code...
Jul 29 '10 #2

P: 5

i tried that and successfully shown the line into the msg box but the msg box value is coming from the textbox. i dont want to take the text box . i want the line directly into the msg box. maybe i am very near to it.i am sending my code. check it out i am attaching the code down

Thanks in advance
gaurav karode
Attached Files
File Type: txt code to read a file and put it into msgbox.txt (1.5 KB, 272 views)
Jul 29 '10 #3

Expert 100+
P: 569
Did you write that code yourself or did you get it from some website? Try searching google for "streamreader c#", "open file c#" and "read from file c#".

Jul 29 '10 #4

P: 64
I think he is trying to show a message (MessageBox.Show())from an application or another web language. In this case you must call a javascript function. here is an example of how to do it.

I hope it help you

Jul 29 '10 #5

P: 5
Thanks for replying. The link u sent to me also takes the data first into a text box but i dont want to show in the text box i want the data directly into the messagebox .please give it a time and try to figure it out
Thak you in advance
Jul 30 '10 #6

P: 64
Well in this case, declare a public class attribute and pass this attribute to your function
Jul 31 '10 #7

Post your reply

Sign in to post your reply or Sign up for a free account.