Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB 6
|
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 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 March 18th, 2004, 05:31 PM
Authorized User
 
Join Date: Mar 2004
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to frankv25
Default dynamic editable buttons on windows form?

Hi there,

Ok, I'm in trouble.

I designed an onscreen keyboard for a registration system in restaurants that can be handled by touchscreen (65 buttons).

The text and name of the buttons need to be dynamicly loaded with data from my database.

I can put it in hard code (but I am lame and dont want to write those few lines 65 times).

dim thisButton as clsButton = new clsButton()
thisButton = thisButton.findByPK("btn1")
btn1.text = thisButton.addText
this works fine but I want to put in in a for ... next loop.

The problem occurs when I need to define wich button needs to be set.

I need something like

for ...
strText = "btn" & i
me.controls(strText).text = thisButton.addText
next ....

Offcourse this doesn't work cause strText is string and not of type button.

Who can help me how I can convert the string to type button and still have it pointing to the button I named btn1.

Hope someone in the WWWorld can help me.

This is my final project before I graduate.

Thank you.


Frank

Frank
__________________
Frank Vandeven
Belgium
 
Old March 18th, 2004, 06:33 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

sure you can get a control from the Controls collection using the control name:
Controls("myButton")
works perfectly... if "myButton" is a standard button, not if as in your case is a clsButton...
BTW2 any reason why you did not use an array of buttons?
best wishes for your graduation,
Marco
 
Old March 19th, 2004, 10:06 AM
Authorized User
 
Join Date: Mar 2004
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to frankv25
Default

Indeed I did it with a array of buttons,

Works great, my code is posted in the vs.net forum.

Thanks,
Frank

Frank





Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic Buttons,SaveToolStrip, adding records KeviJay VB Databases Basics 2 May 28th, 2008 12:46 PM
Dynamic Buttons in PHP Rayne84 PHP How-To 0 March 16th, 2008 07:31 AM
dynamic buttons harpua Flash (all versions) 3 October 19th, 2004 07:33 PM
working with editable buttons frankv25 VS.NET 2002/2003 9 March 18th, 2004 07:57 PM
Dynamic Buttons? TSEROOGY Javascript How-To 6 September 4th, 2003 11:38 AM





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