Current location: Hot Scripts Forums » Programming Languages » Visual Basic » Combobox as a variable


Combobox as a variable

Reply
  #1 (permalink)  
Old 10-28-08, 06:18 AM
norelad norelad is offline
New Member
 
Join Date: Oct 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy Combobox as a variable

I have a form with 14 combobox's that need to have initial values. I dont want to write the same code 14 times therefore I am trying to find a way to alter the combo box name inside a for/next loop.

Code:
For Day = 1 to 14
    For i = 1 to 100
        cbod1time.Items.Add(dtTimes.rows(i).Item(1))
        ' I want to substitute the 1 in cbod1time with the variable Day eg. cbod&Day&time
    Next i
Next D
I come from a VBA background and am trying to do this in Visual Basic with no success. in VBA it would be Me.Controls("cbod" & Day & "time".RowSource = ....

Last edited by digioz; 10-28-08 at 06:51 AM. Reason: Please use code tags!
Reply With Quote
  #2 (permalink)  
Old 11-11-08, 10:00 AM
Yeroon's Avatar
Yeroon Yeroon is offline
Code Master
 
Join Date: Aug 2007
Location: Netherlands, Nijmegen
Posts: 850
Thanks: 2
Thanked 20 Times in 20 Posts
Are you sure you are using plain VB and not VB.Net? I think in normal VB6 you still have control arrays.

Please let us know what exact language and version you use. Depending on that answer I can be more specific towards a solution to your problem.
__________________
Feel free to thank people if they help you by clicking thanks at a post.
=================================
Make it idiot proof and someone will make a better idiot.
=================================
Realise the impotence of proof reading everything you publish
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading XML anupamsr PHP 13 04-19-08 12:57 PM
Variable Variables lkegley9 Flash & ActionScript 1 08-18-07 11:42 PM
global variable problem with functions Dan Man PHP 8 06-26-07 09:33 PM
templating problem (how to forward file name as a variable) skyrat PHP 0 09-11-05 08:27 PM
using variable variables with multiple variables for parts of the name harlock PHP 7 07-26-05 07:35 PM


All times are GMT -5. The time now is 01:18 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.