Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bound textboxes in VB2008 type conversion problem 1

Status
Not open for further replies.

fingers

Programmer
Nov 17, 2000
17
I have a series (5) textboxes bound to a recordset which contains 5 integer values (all 5 digit).
When the record is read, the textboxes are populated correctly and contain the correct values. However, I need an integer array containing these values. I have tried usint cint(textboxname.text), integer.parse(name),ctype(name,integer),val(name) and just plain id(x)=textboxname (since I know the box will always contain an integer.)
I can't single step since that doesn't work either so I have to use a msgbox to see any recovered value. The result seems to be that I can't really read the data from the textbox although I can see the contents on the form. I have tried deleting and reworking the boxes, all to no avail.
Has anyone seen a similiar circumstance where a text box can't be read? I'm baffled!

Bud
 
So you mean that when you do something like msgbox(ctype(textboxname.text, integer)) you get nothing? When are you trying to display the message? Do you press a button or are you trying to use some other event to display the message? Better yet show your code.

-I hate Microsoft!
-Forever and always forward.
-My kingdom for a edit button!
 
Thanks for your reply.
I have since determined that the problem is not type conversion but the fact that I can't read the data from the text box. The textbox contains the correct data (a five digit integer value) but I can't put that data in a listbox, another textbox or a variable. In other words, strNumber = idtextbox.text would yield nothing. The text box is populated by a bindingsource/tableadapter. I have done this successfully with the same database in another test program I wrote but it just won't work in this program. Furthermore, the debug - step won't work with this program either (it just freezes my machine when it hits the breakpoint). I believe there is something wierd in this specific program that is causing several seemingly unrelated issues. I have decided to give it up and start from scratch!
Thanks again!
Bud
 
fingers,
Sounds like your installation of VS may have issues. Once you populate a textbox, you should be able to use that data as you need to. Also, the fact you can't step thru your code leads me to believe you have issues.

I would un-install and re-install vs. Do a google search to find the MS website as to how to un-install vs. It's a real pain in the butt to do, as it takes some concentrated effort.
 
Without seeing more of what is going on like PRPhx says it could be a problem with VS or the code could be corrupted. If it isn't VS then a Clean/Rebuild might work or you may have to start a new project.

On the freeze issue see if you can alt + tab to the code window. I've had that happen sometimes where for some reason it will seem to lock up but actually is having some strange issue with bringing the code window to the front.

Also if you are doing any threading with for loops then watch that as well. An infinite loop in a thread could make it lock up without breaking.

-I hate Microsoft!
-Forever and always forward.
-My kingdom for a edit button!
 
Thanks to both of you (PRPhx and Sorwen) for your advice re the debug problem.
I found the text boxes problem - I hate to admit it, but it was a scope problem which is now resolved.
However, the debug problem is killing me because of the problem of not being able to single-step and view what's going on. I'll try Sorwen's alt+tab for openers and then look into a VS reload.
Thanks again guys for pointing me in the right direction!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top