textbox help in c#

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ankitamca85
    New Member
    • Feb 2008
    • 12

    textbox help in c#

    i have textbox ...i want whatever value (whether integer or double or string type) i give in text box it should take....or accept and then show in message box


    how it is possible?????
    Last edited by ankitamca85; Feb 25 '08, 09:33 AM. Reason: to change title
  • Shashi Sadasivan
    Recognized Expert Top Contributor
    • Aug 2007
    • 1435

    #2
    Do you have a button?

    double click the button on the form, it creates a new method which will handle the button click event. Use this event to extract the text from the textbox.

    If you are using windows forms, use MessageBox.Show () metho

    if it is an asp .net application when you would have to register a javascript (alert) to the page when the button is clicked

    Comment

    • ankitamca85
      New Member
      • Feb 2008
      • 12

      #3
      c# application---

      button1_click

      i=int.parse(tex tbox1.text);
      messagebox.show (i.tostring());

      now first time i insert 12 then msgbox gives 12

      now i want to give string then obviously it will show error.....

      its not possible watever datatype of value i give in textbox it show.....?????? ????

      Comment

      • Shashi Sadasivan
        Recognized Expert Top Contributor
        • Aug 2007
        • 1435

        #4
        Have you tried

        messagebox.show (textbox1.text) ;

        Comment

        Working...