Jump to content
  • Advertisement
Sign in to follow this  

[.net] Problem with textboxes

This topic is 5400 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

And for starters, yes I'm aware I should be using data binding, but I this just seems easier to me and it should be working. Anyways, I have a page load method that loads the page. It looks like this:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
	Systems1.ReadXml(PATH + "Systems.xml")
	NestedSystems1.ReadXml(PATH + "NestedSystems.xml")
End Sub

In this method, you'll notice that I call a function called "FillInfo". In this function, I take the data out of my data set (which is populated by the Systems.xml file) and put it in my text boxes. Here is it:
Private Sub FillInfo(ByVal Position As Integer)
	DescriptionTextBox.Text = Systems1.Systems(Position).SystemDescription
	ImageTextBox.Text = Systems1.Systems(Position).ImagePath
	LongSystemNameTextBox.Text = Systems1.Systems(Position).SystemNameLong
	SystemNameTextBox.Text = Systems1.Systems(Position).SystemName
End Sub

Then the user edits the information to their hearts content. When they are finished, I have a button that is clicked and this function gets called. All it does is make a new data row for the data set, set all the necissary fields (from the text boxes) and then adds the row and removes the row that was edited:
Sub OnSubmit(ByVal Sender As System.Object, ByVal e As System.EventArgs)
	Dim DR As DataRow = Systems1.Systems.NewRow()

	DR("SystemID") = Systems1.Systems(Request.Params("Position")).SystemID
	DR("SystemDescription") = DescriptionTextBox.Text
	DR("SystemName") = SystemNameTextBox.Text
	DR("SystemNameLong") = LongSystemNameTextBox.Text
	DR("ImagePath") = ImageTextBox.Text

	Systems1.WriteXml(PATH + "Systems.xml")
End Sub

The problem I'm having is this: when I stop this function in the debugger, the textbox.text stuff isn't changed from the original values. For instance, if a system name was FOS in the text box, I change it to FOS2, when it gets in this function and SystemNameTextBox.Text is called, it is still FOS. Anybody know what's going on here?

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
Nevermind. I figured it out. When the button is clicked it calls Page_Load which was filling the page with the original info. I just had to add:

if not IsPostBack


Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!