Wrox Programmer Forums
|
Pro VB.NET 2002/2003 For advanced Visual Basic coders working .NET version 2002/2003. Beginning-level questions will be redirected to other forums, including Beginning VB.NET.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB.NET 2002/2003 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 September 12th, 2005, 07:13 PM
Registered User
 
Join Date: Jun 2003
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Strange TextBox Behaviour



I have a VB.NET 2003 program that exhibits a strange TextBox behaviour. The program has a Panel control "mpnlGridInit", that contains a rectangular array of TextBoxes. The TextBoxes are created by row within the array, so that their Item Number within the Panels Controls Collection varies from 0 up to the total number of TextBoxes less 1. When I want to put some String data into a particular TextBox, identified by its row and column number within the array, I use code like the snippet that follows:

    intGridIdx = intRowIdx * 9 + intColIdx
    txtCur = CType(mpnlGridInit.Controls.Item(intGridIdx), TextBox)
    txtCur.Text = strCellVal

The variable "intGridIdx ", which is the TextBox's Item Number within the Control Collection, is computed from the row and column numbers. The TextBox "txtCur" is then identified, using its Item Number within the Controls Collection of the Panel. Finally, the String "strCellVal" is assigned to the Text property of the TextBox "txtCur". This assignment triggers a TextChanged Event that validates the String "strCellVal".

So far so good. In one section of the program, the above code works perfectly. However, in another section of the program, this code fails. Using Debug I noticed that when the code works, the TextBox's Visible property is "True", while when it fails, the TextBox's Visible property is "False". Apparently, the TextBox gets locked in some way that prevents text being entered.

I tried changing the Visible property to "True" while in Debug, but it was immediately changed back to "False". I am at my wits end over this behaviour.

Any ideas would be gratefully accepted.

Jim.








Similar Threads
Thread Thread Starter Forum Replies Last Post
Strange Behaviour VeganMan BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 9 April 14th, 2008 11:16 AM
Strange behaviour with IE smolds BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 2 October 15th, 2005 08:49 PM





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