Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
|
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 8th, 2004, 11:36 AM
Registered User
 
Join Date: Jun 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Retieve new value from TextBox?

I am trying to have a TextBox have a default value when the page is loaded, but if the text is changed and someone clicks on a button, it sends the new value. Whatever I do though, MyBox.Text always equals the value that it was on page loading. Anyone have any suggestions?


 
Old June 8th, 2004, 11:58 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

How are you setting the default value? Are you setting it in the markup of the page or in the Page_Load method?
 
Old June 8th, 2004, 03:26 PM
Registered User
 
Join Date: Jun 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

In Page_Load.

 
Old June 8th, 2004, 03:33 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

And is the assignment conditional based on postback?

If Not IsPostback Then
   MyBox.Text = "Default value"
End If

If it doesn't look like this, it will set the "default" value every time the page loads which will overwrite any posted changed.

(BTW- I guess we are talking about ASP.NET here. You didn't specify web forms or win forms and I didn't even notice the form was just VB.NET. When you post a question in this form, it's helpful to specify detail about the environment and application you are working in where appropriate.)
 
Old June 8th, 2004, 03:41 PM
Registered User
 
Join Date: Jun 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That fixed it. Thanks.

Will remember in future about being more specific. Nice forums, BTW.





Similar Threads
Thread Thread Starter Forum Replies Last Post
TextBox Help iceman90289 C# 2005 6 April 6th, 2008 03:54 AM
pointing cursor from one textbox to other textbox lakshmi_annayappa ASP.NET 1.0 and 1.1 Basics 2 August 2nd, 2007 03:41 PM
How to retieve only the date not date and time debjanib ASP.NET 1.0 and 1.1 Professional 2 July 25th, 2006 01:10 PM
Masked TextBox & formatting TextBox melvik C# 1 September 22nd, 2003 11:01 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.