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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • karodegaurav
    New Member
    • Apr 2010
    • 5

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

    hi,
    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
    Last edited by Niheel; Jul 31 '10, 05:55 PM.
  • ThatThatGuy
    Recognized Expert Contributor
    • Jul 2009
    • 453

    #2
    Have you tried it...
    Then Post some code...

    Comment

    • karodegaurav
      New Member
      • Apr 2010
      • 5

      #3
      want to read the first line from a text file

      hi,

      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
      Last edited by Niheel; Jul 31 '10, 05:55 PM.

      Comment

      • MrMancunian
        Recognized Expert Contributor
        • Jul 2008
        • 569

        #4
        Did you write that code yourself or did you get it from some website? Try searching google for "streamread er c#", "open file c#" and "read from file c#".

        Steven

        Comment

        • Sfreak
          New Member
          • Mar 2010
          • 64

          #5
          I think he is trying to show a message (MessageBox.Sho w())from an asp.net application or another web language. In this case you must call a javascript function. here is an example of how to do it. http://www.savetosim.com/javascript/ch01.html

          I hope it help you

          []´s

          Comment

          • karodegaurav
            New Member
            • Apr 2010
            • 5

            #6
            Originally posted by Sfreak
            I think he is trying to show a message (MessageBox.Sho w())from an asp.net application or another web language. In this case you must call a javascript function. here is an example of how to do it. http://www.savetosim.com/javascript/ch01.html

            I hope it help you

            []´s
            hi,
            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

            Comment

            • Sfreak
              New Member
              • Mar 2010
              • 64

              #7
              Well in this case, declare a public class attribute and pass this attribute to your function
              onClick="MsgBox (MyClassAttribu te)">

              Comment

              Working...